diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorCronTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorCronTest.php index 0966937..47617a0 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorCronTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorCronTest.php @@ -22,7 +22,7 @@ public static function getInfo() { public function testCron() { // Create feed and test basic updating on cron. global $base_url; - $key = config('system.cron')->get('key'); + $key = state()->get('system.cron_key'); $this->createSampleNodes(); $feed = $this->createFeed(); $this->cronRun(); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index ecf2861..48887a6 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -1430,7 +1430,7 @@ protected function drupalPostAJAX($path, $edit, $triggering_element, $ajax_path * Runs cron in the Drupal installed by Simpletest. */ protected function cronRun() { - $this->drupalGet('cron/' . config('system.cron')->get('key')); + $this->drupalGet('cron/' . state()->get('system.cron_key')); } /** diff --git a/core/modules/system/config/system.cron.yml b/core/modules/system/config/system.cron.yml index b9a5096..aa41f1b 100644 --- a/core/modules/system/config/system.cron.yml +++ b/core/modules/system/config/system.cron.yml @@ -1,4 +1,3 @@ -key: '' threshold: autorun: '10800' requirements_warning: '172800' diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php index ebdb103..1e8662c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php @@ -42,7 +42,7 @@ function testCronRun() { $this->assertResponse(403); // Run cron anonymously with the valid cron key. - $key = config('system.cron')->get('key'); + $key = state()->get('system.cron_key'); $this->drupalGet('cron/' . $key); $this->assertResponse(204); } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 8127e00..e0772ad 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -294,7 +294,7 @@ function system_requirements($phase) { } $description .= ' ' . $t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); - $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . $cron_config->get('key')))); + $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . state()->get('system.cron_key')))); $requirements['cron'] = array( 'title' => $t('Cron maintenance tasks'), @@ -512,11 +512,9 @@ function system_install() { variable_set('theme_default', 'stark'); config_install_default_config('theme', 'stark'); - // Populate the cron key variable. + // Populate the cron key state variable. $cron_key = drupal_hash_base64(drupal_random_bytes(55)); - config('system.cron') - ->set('key', $cron_key) - ->save(); + state()->set('system.cron_key', $cron_key); } /** @@ -1750,17 +1748,21 @@ function system_update_8008() { } /** - * Moves cron system settings from variable to config. + * Moves cron system settings from variable to config/state. * * @ingroup config_upgrade */ function system_update_8009() { update_variables_to_config('system.cron', array( - 'cron_key' => 'key', 'cron_safe_threshold' => 'threshold.autorun', 'cron_threshold_warning' => 'threshold.requirements_warning', 'cron_threshold_error' => 'threshold.requirements_error', )); + + if ($cron_key = update_variable_get('cron_key', FALSE)) { + state()->set('system.cron_key', $cron_key); + } + update_variable_del('cron_key'); } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index ea3dadc..8cf57eb 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1101,7 +1101,7 @@ function system_cron_page() { * @see system_cron_page(). */ function system_cron_access($key) { - if ($key != config('system.cron')->get('key')) { + if ($key != state()->get('system.cron_key')) { watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE); return FALSE; }