You are here

function elysia_cron_run_job in Elysia Cron 7.2

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

Public function to execute a single job.

Parameters

bool $ignore_disable: Run the job even if disabled.

bool $ignore_time: Run the job even if not ready.

bool $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
Custom callback for 'elysia-cron' drush command.
elysia_cron_execute_page in ./elysia_cron.admin.inc
Page callback for 'admin/config/system/cron/execute/%' path.

File

./elysia_cron.module, line 1376

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;

        // Register shutdown callback.
        register_shutdown_function('elysia_cron_run_job_cleanup');
        elysia_cron_internal_execute_job($job);
        $_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');
  }
}