1.20.x system.module system_run_automated_cron()

Run the automated cron if enabled.

File

modules/system/system.module, line 3893
Configuration system that lets administrators modify the workings of the site.

Code

function system_run_automated_cron() {
  // If the site is not fully installed, suppress the automated cron run.
  // Otherwise it could be triggered prematurely by Ajax requests during
  // installation.
  if (($threshold = config('system.core')->get('cron_safe_threshold')) > 0 && state_get('install_task') == 'done') {
    $cron_last = state_get('cron_last', NULL);
    if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) {
      backdrop_cron_run();
    }
  }
}