Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.