public function UltimateCronCommands::run in Ultimate Cron 8.2
Run cron job.
@command cron:run
@option force Skip the schedule check for each job. Locks are still respected. @option options Custom options for plugins, e.g. --options=thread=1 for serial launcher @usage drush cron-run node_cron Run the node_cron job @aliases crun cron-run
Parameters
string $name: Job to run.
array $options: Options array.
File
- src/
Commands/ UltimateCronCommands.php, line 277
Class
- UltimateCronCommands
- Class UltimateCronCommands.
Namespace
Drupal\ultimate_cron\CommandsCode
public function run($name = NULL, array $options = [
'force' => NULL,
'options' => NULL,
]) {
if ($o = $options['options']) {
$pairs = explode(',', $o);
foreach ($pairs as $pair) {
list($key, $value) = explode('=', $pair);
CronPlugin::setGlobalOption(trim($key), trim($value));
}
}
$force = $options['force'];
if (!$name) {
throw new \Exception(dt("Running all cronjobs is not supported by Ultimate Cron's cron:run - please use Drupal Core's core:cron command!"));
}
// Run a specific job.
$job = CronJob::load($name);
if (!$job) {
throw new \Exception(dt('@name not found', [
'@name' => $name,
]));
}
if ($force || $job
->isScheduled()) {
$job
->run(t('Launched by drush'));
}
}