Skip to content

Commit

Permalink
[database:log:poll] Register commmand. (#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas authored Jan 19, 2017
1 parent a66a5c7 commit 3cc1e8b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
5 changes: 5 additions & 0 deletions config/services/drupal-console/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ services:
arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation']
tags:
- { name: drupal.command }
console.database_log_poll:
class: Drupal\Console\Command\Database\LogPollCommand
arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation']
tags:
- { name: drupal.command }
console.database_restore:
class: Drupal\Console\Command\Database\RestoreCommand
arguments: ['@app.root']
Expand Down
43 changes: 21 additions & 22 deletions src/Command/Database/LogPollCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,28 @@
class LogPollCommand extends DatabaseLogBase
{
/**
* @var
*/
* @var
*/
protected $duration;

/**
*
*/
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);

$io->note($this->trans('commands.database.log.poll.messages.warning'));

$this->getDefaultOptions($input);
$this->duration = $input->getArgument('duration');

$this->pollForEvents($io);
}

/**
* {@inheritdoc}
*/
protected function configure()
{
$this
Expand All @@ -39,24 +54,8 @@ protected function configure()
}

/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);

$io->note($this->trans('commands.database.log.poll.messages.warning'));

$this->getDefaultOptions($input);
$this->duration = $input->getArgument('duration');

$this->pollForEvents($io);
}

/**
* @param \Drupal\Console\Core\Style\DrupalStyle $io
*/
* @param DrupalStyle $io
*/
protected function pollForEvents(DrupalStyle $io)
{
$query = $this->makeQuery($io)->countQuery();
Expand Down

0 comments on commit 3cc1e8b

Please sign in to comment.