You are here

function elysia_cron_should_run in Elysia Cron 7.2

Same name and namespace in other branches
  1. 5.2 elysia_cron_scheduler.inc \elysia_cron_should_run()
  2. 5.2 elysia_cron_scheduler_old.inc \elysia_cron_should_run()
  3. 5 elysia_cron_scheduler.inc \elysia_cron_should_run()
  4. 5 elysia_cron_scheduler_old.inc \elysia_cron_should_run()
  5. 6.2 elysia_cron_scheduler.inc \elysia_cron_should_run()
  6. 6.2 elysia_cron_scheduler_old.inc \elysia_cron_should_run()
  7. 6 elysia_cron_scheduler.inc \elysia_cron_should_run()
  8. 6 elysia_cron_scheduler_old.inc \elysia_cron_should_run()
  9. 7 elysia_cron_scheduler.inc \elysia_cron_should_run()
  10. 7 elysia_cron_scheduler_old.inc \elysia_cron_should_run()

Function for cron run schedule.

5 calls to elysia_cron_should_run()
drush_elysia_cron_run_wrapper in ./elysia_cron.drush.inc
Custom callback for 'elysia-cron' drush command.
elysia_cron_active_jobs in ./elysia_cron.module
Get all jobs that needs to be executed in a channel
elysia_cron_admin_page in ./elysia_cron.admin.inc
Page callback for 'admin/config/system/cron' path.
elysia_cron_run_job in ./elysia_cron.module
Public function to execute a single job.
test_elysia_cron_should_run in ./elysia_cron_scheduler.inc
Test function for elysia_cron_should_run().

File

./elysia_cron_scheduler.inc, line 11
Schedules cron runs.

Code

function elysia_cron_should_run($conf, $now = -1, $ignore_disable = FALSE, $ignore_time = FALSE) {
  if (!$ignore_disable && $conf['disabled']) {
    return FALSE;
  }
  if ($ignore_time) {
    return TRUE;
  }
  if ($now < 0) {
    $now = time();
  }
  if (!$conf['last_run'] || $now - $conf['last_run'] > 365 * 86400) {
    return TRUE;
  }
  $next_run = _elysia_cron_next_run($conf);
  return $now >= $next_run;
}