X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FDatabase%2FLogClearCommand.php;h=491ccd7b5176938ad7634daa00f1df304262970b;hp=84a1bb3eef885a738bb72829143096565e4d0c08;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Database/LogClearCommand.php b/vendor/drupal/console/src/Command/Database/LogClearCommand.php index 84a1bb3ee..491ccd7b5 100644 --- a/vendor/drupal/console/src/Command/Database/LogClearCommand.php +++ b/vendor/drupal/console/src/Command/Database/LogClearCommand.php @@ -11,16 +11,12 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Logger\RfcLogLevel; -use Drupal\Console\Core\Style\DrupalStyle; class LogClearCommand extends Command { - use CommandTrait; - /** * @var Connection */ @@ -67,7 +63,8 @@ class LogClearCommand extends Command null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.user-id') - ); + ) + ->setAliases(['dblc']); } /** @@ -75,33 +72,30 @@ class LogClearCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - $eventId = $input->getArgument('event-id'); $eventType = $input->getOption('type'); $eventSeverity = $input->getOption('severity'); $userId = $input->getOption('user-id'); if ($eventId) { - $this->clearEvent($io, $eventId); + $this->clearEvent($eventId); } else { - $this->clearEvents($io, $eventType, $eventSeverity, $userId); + $this->clearEvents($eventType, $eventSeverity, $userId); } return 0; } /** - * @param DrupalStyle $io * @param $eventId * @return bool */ - private function clearEvent(DrupalStyle $io, $eventId) + private function clearEvent($eventId) { $result = $this->database->delete('watchdog')->condition('wid', $eventId)->execute(); if (!$result) { - $io->error( + $this->getIo()->error( sprintf( $this->trans('commands.database.log.clear.messages.not-found'), $eventId @@ -111,7 +105,7 @@ class LogClearCommand extends Command return false; } - $io->success( + $this->getIo()->success( sprintf( $this->trans('commands.database.log.clear.messages.event-deleted'), $eventId @@ -122,13 +116,12 @@ class LogClearCommand extends Command } /** - * @param DrupalStyle $io * @param $eventType * @param $eventSeverity * @param $userId * @return bool */ - protected function clearEvents(DrupalStyle $io, $eventType, $eventSeverity, $userId) + protected function clearEvents($eventType, $eventSeverity, $userId) { $severity = RfcLogLevel::getLevels(); $query = $this->database->delete('watchdog'); @@ -139,7 +132,7 @@ class LogClearCommand extends Command if ($eventSeverity) { if (!in_array($eventSeverity, $severity)) { - $io->error( + $this->getIo()->error( sprintf( $this->trans('commands.database.log.clear.messages.invalid-severity'), $eventSeverity @@ -159,14 +152,14 @@ class LogClearCommand extends Command $result = $query->execute(); if (!$result) { - $io->error( + $this->getIo()->error( $this->trans('commands.database.log.clear.messages.clear-error') ); return false; } - $io->success( + $this->getIo()->success( $this->trans('commands.database.log.clear.messages.clear-sucess') );