You are here

function elysia_cron_run_job in Elysia Cron 6.2

Same name and namespace in other branches
  1. 7.2 elysia_cron.module \elysia_cron_run_job()

Public function to execute a single job

Parameters

$ignore_disable Run the job even if disabled:

$ignore_time Run the job even if not ready:

$ignore_running Run the job even if already running:

2 calls to elysia_cron_run_job()
drush_elysia_cron_run_wrapper in ./elysia_cron.drush.inc
A drush command callback.
elysia_cron_execute_page in ./elysia_cron.admin.inc

File

./elysia_cron.module, line 1154

Code

function elysia_cron_run_job($job, $ignore_disable = false, $ignore_time = false, $ignore_running = false) {
  global $cron_completed, $cron_executing_job, $elysia_cron_settings;
  elysia_cron_initialize();
  if (isset($elysia_cron_settings[$job])) {
    if (elysia_cron_should_run($elysia_cron_settings[$job], -1, $ignore_disable, $ignore_time)) {
      if ($ignore_running || !elysia_cron_check_run_job($job)) {
        $cron_completed = false;
        $cron_executing_job = $job;
        elysia_cron_before_execution();

        // Register shutdown callback
        register_shutdown_function('elysia_cron_run_job_cleanup');
        elysia_cron_internal_execute_job($job);
        elysia_cron_after_execution();
        $cron_completed = true;
        elysia_cron_message('Job executed');
      }
      else {
        elysia_cron_debug('Job is already running, skipping');
      }
    }
    else {
      elysia_cron_debug('Job is disabled or not ready to be executed, skipping');
    }
  }
  else {
    elysia_cron_warning('Job not found, skipping');
  }
}