You are here

function drush_ultimate_cron_cron_enable in Ultimate Cron 7.2

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

Enable a cron job.

File

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

Code

function drush_ultimate_cron_cron_enable($name = NULL) {
  if (!$name) {
    if (!drush_get_option('all')) {
      return drush_set_error(dt('No job specified?'));
    }
    foreach (_ultimate_cron_job_load_all() as $job) {
      drush_ultimate_cron_cron_enable($job->name);
    }
    return;
  }
  $job = _ultimate_cron_job_load($name);
  if (!$job) {
    drush_print(dt('The job named "@name" could not be enabled, be sure this is the correct job name', array(
      '@name' => $name,
    )));
    return;
  }
  if ($job
    ->enable()) {
    drush_print(dt('@name enabled', array(
      '@name' => $name,
    )));
  }
}