diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 978b0f4..8ea3f56 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1588,7 +1588,7 @@ function system_cron_settings() { $form['cron']['cron_safe_threshold'] = array( '#type' => 'select', '#title' => t('Run cron every'), - '#default_value' => variable_get('cron_safe_threshold', DRUPAL_CRON_DEFAULT_THRESHOLD), + '#default_value' => config('system.cron')->get('cron_safe_threshold'), '#options' => array(0 => t('Never')) + drupal_map_assoc(array(3600, 10800, 21600, 43200, 86400, 604800), 'format_interval'), ); diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 14d4853..c78e38d 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1761,6 +1761,14 @@ function system_update_8004() { } /** + * Upgrade cron variable system: + * Remove cron_safe_threshold from variable table. + */ +function system_update_8005() { + variable_del('cron_safe_threshold'); +} + +/** * @} End of "defgroup updates-7.x-to-8.x" * The next series of updates should start at 9000. */ diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 94fd3e0..24ec64e 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -11,11 +11,6 @@ const DRUPAL_MAXIMUM_TEMP_FILE_AGE = 21600; /** - * Default interval for automatic cron executions in seconds. - */ -const DRUPAL_CRON_DEFAULT_THRESHOLD = 10800; - -/** * New users will be set to the default time zone at registration. */ const DRUPAL_USER_TIMEZONE_DEFAULT = 0; @@ -3515,7 +3510,7 @@ 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 = variable_get('cron_safe_threshold', DRUPAL_CRON_DEFAULT_THRESHOLD)) > 0 && variable_get('install_task') == 'done') { + if (($threshold = config('system.cron')->get('cron_safe_threshold')) > 0 && variable_get('install_task') == 'done') { $cron_last = variable_get('cron_last', NULL); if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) { drupal_cron_run(); diff --git a/core/modules/system/system.test b/core/modules/system/system.test index 9287d16..f057423 100644 --- a/core/modules/system/system.test +++ b/core/modules/system/system.test @@ -771,7 +771,9 @@ class CronRunTestCase extends DrupalWebTestCase { $cron_last = time(); $cron_safe_threshold = 100; variable_set('cron_last', $cron_last); - variable_set('cron_safe_threshold', $cron_safe_threshold); + config('system.cron') + ->set('cron_safe_threshold', $cron_safe_threshold) + ->save(); $this->drupalGet(''); $this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is not passed.'));