Skip to content
Snippets Groups Projects

#3463392 Added better cron management

10 files
+ 296
3
Compare changes
  • Side-by-side
  • Inline
Files
10
+ 50
0
<?php
namespace Drupal\inactive_user_workflow\Commands;
use Drupal\Core\Messenger\MessengerInterface;
use Drush\Commands\DrushCommands;
/**
* Drush 10 Inactive Users Workflow commands for Drupal Core 8.4+.
*/
class InactiveUsersWorkflowCommands extends DrushCommands {
/**
* The Messenger service.
*
* @var \Drupal\Core\Messenger\MessengerInterface
*/
protected $messenger;
/**
* InactiveUsersWorkflowCommands constructor.
*
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* Messenger service.
*/
public function __construct(MessengerInterface $messenger) {
parent::__construct();
$this->messenger = $messenger;
}
/**
* Lightweight cron to process Inactive Users Workflow module tasks.
*
* @param array $options
* An associative array of options whose values come from cli, aliases,
* config, etc.
*
* @option nomsg
* to avoid the "cron completed" message being written to the terminal.
*
* @command inactive_user_workflow:cron
* @aliases inactive_user_workflow-cron, iuw-cron
*/
public function cron(array $options = ['nomsg' => NULL]) {
inactive_user_workflow_cron();
$options['nomsg'] ? NULL : $this->messenger->addMessage(dt('Inactive Users Workflow lightweight cron completed.'));
}
}
Loading