You are here

function drush_ultimate_cron_cron_run in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8.2 ultimate_cron.drush.inc \drush_ultimate_cron_cron_run()
  2. 8 ultimate_cron.drush.inc \drush_ultimate_cron_cron_run()
  3. 6 ultimate_cron.drush.inc \drush_ultimate_cron_cron_run()
  4. 7 ultimate_cron.drush.inc \drush_ultimate_cron_cron_run()

Run cron job(s).

1 string reference to 'drush_ultimate_cron_cron_run'
ultimate_cron_drush_command_alter in ./ultimate_cron.drush.inc
Implements hook_drush_command_alter().

File

./ultimate_cron.drush.inc, line 415
Drush commands for Ultimate Cron!

Code

function drush_ultimate_cron_cron_run($name = NULL) {
  if ($options = drush_get_option('options')) {
    $pairs = explode(',', $options);
    foreach ($pairs as $pair) {
      list($key, $value) = explode('=', $pair);
      UltimateCronPlugin::setGlobalOption(trim($key), trim($value));
    }
  }
  if (!$name) {
    if (drush_get_option('force')) {
      UltimateCronPlugin::setGlobalOption('bypass_schedule', TRUE);
    }
    ultimate_cron_run_scheduled(FALSE);
  }
  else {
    $job = _ultimate_cron_job_load($name);
    if (!$job) {
      return drush_set_error(dt('@name not found', array(
        '@name' => $name,
      )));
    }
    if (drush_get_option('check-schedule')) {
      if (!$job
        ->isScheduled()) {
        return;
      }
    }
    $job
      ->launch();
  }
}