X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FDatabase%2FLogDebugCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FDatabase%2FLogDebugCommand.php;h=0000000000000000000000000000000000000000;hp=de702d860c40702dd206172fdf41733c4ab3cd32;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Database/LogDebugCommand.php b/vendor/drupal/console/src/Command/Database/LogDebugCommand.php deleted file mode 100644 index de702d860..000000000 --- a/vendor/drupal/console/src/Command/Database/LogDebugCommand.php +++ /dev/null @@ -1,172 +0,0 @@ -setName('database:log:debug') - ->setDescription($this->trans('commands.database.log.debug.description')); - - $this->addDefaultLoggingOptions(); - - $this - ->addArgument( - 'event-id', - InputArgument::OPTIONAL, - $this->trans('commands.database.log.debug.arguments.event-id') - ) - ->addOption( - 'asc', - null, - InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.asc') - ) - ->addOption( - 'limit', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.limit') - ) - ->addOption( - 'offset', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.offset'), - 0 - ) - ->addOption( - 'yml', - null, - InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.yml'), - null - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $this->getDefaultOptions($input); - $this->eventId = $input->getArgument('event-id'); - $this->asc = $input->getOption('asc'); - $this->limit = $input->getOption('limit'); - $this->offset = $input->getOption('offset'); - $this->ymlStyle = $input->getOption('yml'); - - - if ($this->eventId) { - return $this->getEventDetails($io); - } else { - return $this->getAllEvents($io); - } - } - - /** - * @param $io - * @param $eventId - * @return bool - */ - private function getEventDetails(DrupalStyle $io) - { - $dblog = $this->database - ->query( - 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', - [':id' => $this->eventId] - ) - ->fetchObject(); - - if (!$dblog) { - $io->error( - sprintf( - $this->trans('commands.database.log.debug.messages.not-found'), - $this->eventId - ) - ); - return 1; - } - - if ($this->ymlStyle) { - $io->writeln(Yaml::encode($this->formatSingle($dblog))); - } else { - $io->table( - $this->createTableHeader(), - [$this->createTableRow($dblog)] - ); - } - } - - /** - * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @return bool - */ - private function getAllEvents(DrupalStyle $io) - { - $query = $this->makeQuery($io); - - $result = $query->execute(); - - $tableRows = []; - foreach ($result as $dblog) { - $tableRows[] = $this->createTableRow($dblog); - } - - $io->table( - $this->createTableHeader(), - $tableRows - ); - - return true; - } -}