Skip to content

Instantly share code, notes, and snippets.

@mikeyp
Created August 8, 2017 20:28
Show Gist options
  • Save mikeyp/af9a621f9da6fef8d145b197e3918eb9 to your computer and use it in GitHub Desktop.
Save mikeyp/af9a621f9da6fef8d145b197e3918eb9 to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\waiting_queue\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Annotations\DrupalCommand;
/**
* Class ProcessWaitingQueueCommand.
*
* @DrupalCommand (
* extension="waiting_queue",
* extensionType="module"
* )
*/
class ProcessWaitingQueueCommand extends Command {
use ContainerAwareCommandTrait;
/**
* {@inheritdoc}
*/
protected function configure() {
$this
->setName('waiting_queue:process_queue')
->setDescription($this->trans('commands.waiting_queue.process_queue.description'));
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$io = new DrupalStyle($input, $output);
set_time_limit(0);
if (function_exists('pcntl_signal')) {
$queue_runner = \Drupal::service('waiting_queue.signal_queue_runner_service');
}
else {
$queue_runner = \Drupal::service('waiting_queue.queue_runner_service');
}
$queue_runner->processQueue('puppet_docs_import');
$io->info('success');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment