diff -u b/core/modules/update/config/update.settings.yml b/core/modules/update/config/update.settings.yml --- b/core/modules/update/config/update.settings.yml +++ b/core/modules/update/config/update.settings.yml @@ -3,10 +3,10 @@ - fetch_url: '' - disabled: '0' - executed: '0' - frequency: '1' - max_fetch_attempts: '2' - max_fetch_time: '5' + disabled_extensions: '0' + interval_days: '1' +d8_requirements: '0' +fetch: + url: '' + max_attempts: '2' + timeout: '5' notification: - emails: {} - send: '0' - threshold: '0' + emails: [] + threshold: '0' diff -u b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php --- b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php @@ -40,7 +40,7 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus(array('drupal' => '0', 'aaa_update_test' => 'no-releases')); $this->drupalGet('admin/reports/updates'); // Cannot use $this->standardTests() because we need to check for the @@ -68,7 +68,7 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus( array( 'drupal' => '0', @@ -127,7 +127,7 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus(array('drupal' => '0', '#all' => '1_0')); $this->standardTests(); // We're expecting the report to say all projects are up to date. @@ -184,7 +184,7 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $xml_mapping = array( 'drupal' => '0', 'update_test_subtheme' => '1_0', @@ -230,8 +230,8 @@ // total number of attempts made in the test may exceed the default value // of update_max_fetch_attempts. Therefore this variable is set very high // to avoid test failures in those cases. - $update_settings->set('check.max_fetch_attempts', 99999)->save(); - variable_set('update_test_system_info', $system_info); + $update_settings->set('fetch.max_attempts', 99999)->save(); + config('update_test.settings')->set('system_info', $system_info)->save(); $xml_mapping = array( 'drupal' => '0', 'update_test_subtheme' => '1_0', @@ -240,7 +240,7 @@ $base_theme_project_link = l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'); $sub_theme_project_link = l(t('Update test subtheme'), 'http://example.com/project/update_test_subtheme'); foreach (array(TRUE, FALSE) as $check_disabled) { - $update_settings->set('check.disabled', $check_disabled)->save(); + $update_settings->set('check.disabled_extensions', $check_disabled)->save(); $this->refreshUpdateStatus($xml_mapping); // In neither case should we see the "Themes" heading for enabled themes. $this->assertNoText(t('Themes')); @@ -281,7 +281,7 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $xml_mapping = array( 'drupal' => '0', @@ -323,6 +323,7 @@ */ function testHookUpdateStatusAlter() { variable_set('allow_authorize_operations', TRUE); + $update_test_config = config('update_test.settings'); $update_admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer software updates')); $this->drupalLogin($update_admin_user); @@ -336,13 +337,13 @@ 'hidden' => FALSE, ), ); - variable_set('update_test_system_info', $system_info); + $update_test_config->set('system_info', $system_info)->save(); $update_status = array( 'aaa_update_test' => array( 'status' => UPDATE_NOT_SECURE, ), ); - variable_set('update_test_update_status', $update_status); + $update_test_config->set('update_status', $update_status)->save(); $this->refreshUpdateStatus( array( 'drupal' => '0', @@ -356,19 +357,19 @@ // Visit the reports page again without the altering and make sure the // status is back to normal. - variable_set('update_test_update_status', array()); + $update_test_config->set('update_status', array())->save(); $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText(t('Security update required!')); $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.')); // Turn the altering back on and visit the Update manager UI. - variable_set('update_test_update_status', $update_status); + $update_test_config->set('update_status', $update_status)->save(); $this->drupalGet('admin/modules/update'); $this->assertText(t('Security update')); // Turn the altering back off and visit the Update manager UI. - variable_set('update_test_update_status', array()); + $update_test_config->set('update_status', array())->save(); $this->drupalGet('admin/modules/update'); $this->assertNoText(t('Security update')); } diff -u b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php --- b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php @@ -83,7 +83,7 @@ 'datestamp' => '1000000000', ), ); - variable_set('update_test_system_info', $system_info); + config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus(array('drupal' => 'dev')); $this->assertNoText(t('2001-Sep-')); $this->assertText(t('Up to date')); @@ -96,8 +96,8 @@ */ function testModulePageRunCron() { $this->setSystemInfo7_0(); - config('update.settings')->set('check.fetch_url', url('update-test', array('absolute' => TRUE)))->save(); - variable_set('update_test_xml_map', array('drupal' => '0')); + config('update.settings')->set('fetch.url', url('update-test', array('absolute' => TRUE)))->save(); + config('update_test.settings')->set('xml_map', array('drupal' => '0'))->save(); $this->cronRun(); $this->drupalGet('admin/modules'); @@ -110,8 +110,8 @@ function testModulePageUpToDate() { $this->setSystemInfo7_0(); // Instead of using refreshUpdateStatus(), set these manually. - config('update.settings')->set('check.fetch_url', url('update-test', array('absolute' => TRUE)))->save(); - variable_set('update_test_xml_map', array('drupal' => '0')); + config('update.settings')->set('fetch.url', url('update-test', array('absolute' => TRUE)))->save(); + config('update_test.settings')->set('xml_map', array('drupal' => '0'))->save(); $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); @@ -127,8 +127,8 @@ function testModulePageRegularUpdate() { $this->setSystemInfo7_0(); // Instead of using refreshUpdateStatus(), set these manually. - config('update.settings')->set('check.fetch_url', url('update-test', array('absolute' => TRUE)))->save(); - variable_set('update_test_xml_map', array('drupal' => '1')); + config('update.settings')->set('fetch.url', url('update-test', array('absolute' => TRUE)))->save(); + config('update_test.settings')->set('xml_map', array('drupal' => '1'))->save(); $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); @@ -144,8 +144,8 @@ function testModulePageSecurityUpdate() { $this->setSystemInfo7_0(); // Instead of using refreshUpdateStatus(), set these manually. - config('update.settings')->set('check.fetch_url', url('update-test', array('absolute' => TRUE)))->save(); - variable_set('update_test_xml_map', array('drupal' => '2-sec')); + config('update.settings')->set('fetch.url', url('update-test', array('absolute' => TRUE)))->save(); + config('update_test.settings')->set('xml_map', array('drupal' => '2-sec'))->save(); $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); @@ -220,5 +220,5 @@ ), ); - variable_set('update_test_system_info', $setting); + config('update_test.settings')->set('system_info', $setting)->save(); } } diff -u b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php --- b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php @@ -43,9 +43,9 @@ protected function refreshUpdateStatus($xml_map, $url = 'update-test') { // Tell the Update Manager module to fetch from the URL provided by // update_test module. - config('update.settings')->set('check.fetch_url', url($url, array('absolute' => TRUE)))->save(); + config('update.settings')->set('fetch.url', url($url, array('absolute' => TRUE)))->save(); // Save the map for update_test_mock_page() to use. - variable_set('update_test_xml_map', $xml_map); + config('update_test.settings')->set('xml_map', $xml_map)->save(); // Manually check the update status. $this->drupalGet('admin/reports/updates/check'); } diff -u b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php --- b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateUploadTest.php @@ -75,9 +75,11 @@ 'version' => '7.0', ), ); - variable_set('update_test_system_info', $setting); - config('update.settings')->set('check.fetch_url', url('update-test', array('absolute' => TRUE)))->save(); - variable_set('update_test_xml_map', array('drupal' => '2-sec')); + config('update_test.settings') + ->set('system_info', $setting) + ->set('xml_map', array('drupal' => '2-sec')) + ->save(); + config('update.settings')->set('fetch.url', url('update-test', array('absolute' => TRUE)))->save(); // Initialize the update status. $this->drupalGet('admin/reports/updates'); diff -u b/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc --- b/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -64,7 +64,7 @@ $theme_data = system_rebuild_theme_data(); update_process_info_list($projects, $module_data, 'module', TRUE); update_process_info_list($projects, $theme_data, 'theme', TRUE); - if (config('update.settings')->get('check.disabled')) { + if (config('update.settings')->get('check.disabled_extensions')) { update_process_info_list($projects, $module_data, 'module', FALSE); update_process_info_list($projects, $theme_data, 'theme', FALSE); } diff -u b/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc --- b/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -107,7 +107,7 @@ */ function _update_fetch_data() { $queue = queue('update_fetch_tasks'); - $end = time() + config('update.settings')->get('check.max_fetch_time'); + $end = time() + config('update.settings')->get('fetch.timeout'); while (time() < $end && ($item = $queue->claimItem())) { _update_process_fetch_task($item->data); $queue->deleteItem($item); @@ -141,7 +141,7 @@ } } - $max_fetch_attempts = $update_config->get('check.max_fetch_attempts'); + $max_fetch_attempts = $update_config->get('fetch.max_attempts'); $success = FALSE; $available = array(); @@ -178,7 +178,7 @@ } } - $frequency = $update_config->get('check.frequency'); + $frequency = $update_config->get('check.interval_days'); $cid = 'available_releases::' . $project_name; _update_cache_set($cid, $available, $now + (60 * 60 * 24 * $frequency)); @@ -186,7 +186,7 @@ _update_cache_set('fetch_failures', $fail, $now + (60 * 5)); // Whether this worked or not, we did just (try to) check for updates. - $update_config->set('check.executed', $now)->save(); + variable_set('update_last_check', $now); // Now that we processed the fetch task for this project, clear out the // record in {cache_update} for this task so we're willing to fetch again. @@ -329,9 +329,16 @@ * @see _update_build_fetch_url() */ function _update_get_fetch_url_base($project) { - $config_url = config('update.settings')->get('check.fetch_url'); - $default_url = !empty($config_url) ? $config_url : UPDATE_DEFAULT_URL; - return isset($project['info']['project status url']) ? $project['info']['project status url'] : $default_url; + if (isset($project['info']['project status url'])) { + $url = $project['info']['project status url']; + } + else { + $url = config('update.settings')->get('fetch.url'); + if (empty($url)) { + $url = UPDATE_DEFAULT_URL; + } + } + return $url; } /** @@ -371,7 +378,7 @@ // Track when the last mail was successfully sent to avoid sending // too many e-mails. if ($message['result']) { - $update_config->set('notification.send', REQUEST_TIME)->save(); + variable_set('update_last_email_notification', REQUEST_TIME); } } } diff -u b/core/modules/update/update.install b/core/modules/update/update.install --- b/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -150,14 +150,12 @@ function update_update_8000() { update_variables_to_config('update.settings', array( 'update_advanced_project_settings' => 'advanced_project_settings', - 'update_fetch_url' => 'check.fetch_url', - 'update_check_disabled' => 'check.disabled', - 'update_last_check' => 'check.executed', - 'update_check_frequency' => 'check.frequency', - 'update_max_fetch_attempts' => 'check.max_fetch_attempts', - 'update_max_fetch_time' => 'check.max_fetch_time', + 'update_check_disabled' => 'check.disabled_extensions', + 'update_check_frequency' => 'check.interval_days', + 'update_fetch_url' => 'fetch.url', + 'update_max_fetch_attempts' => 'fetch.max_attempts', + 'update_max_fetch_time' => 'fetch.timeout', 'update_notify_emails' => 'notification.emails', - 'update_last_email_notification' => 'notification.send', 'update_notification_threshold' => 'notification.threshold', )); } reverted: --- b/core/modules/update/update.manager.inc +++ a/core/modules/update/update.manager.inc @@ -278,7 +278,7 @@ */ function theme_update_manager_update_form($variables) { $form = $variables['form']; + $last = variable_get('update_last_check', 0); - $last = config('update.settings')->get('check.executed'); $output = theme('update_last_check', array('last' => $last)); $output .= drupal_render_children($form); return $output; diff -u b/core/modules/update/update.module b/core/modules/update/update.module --- b/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -283,9 +283,9 @@ */ function update_cron() { $update_config = config('update.settings'); - $frequency = $update_config->get('check.frequency'); + $frequency = $update_config->get('check.interval_days'); $interval = 60 * 60 * 24 * $frequency; - if ((REQUEST_TIME - $update_config->get('check.executed')) > $interval) { + if ((REQUEST_TIME - variable_get('update_last_check', 0)) > $interval) { // If the configured update interval has elapsed, we want to invalidate // the cached data for all projects, attempt to re-fetch, and trigger any // configured notifications about the new status. @@ -297,7 +297,7 @@ // missing data, and if so, try to fetch the data. update_get_available(TRUE); } - if ((REQUEST_TIME - $update_config->get('notification.send')) > $interval) { + if ((REQUEST_TIME - variable_get('update_last_email_notification', 0)) > $interval) { // If configured time between notifications elapsed, send email about // updates possibly available. module_load_include('inc', 'update', 'update.fetch'); diff -u b/core/modules/update/update.report.inc b/core/modules/update/update.report.inc --- b/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -33,7 +33,7 @@ function theme_update_report($variables) { $data = $variables['data']; - $last = config('update.settings')->get('check.executed'); + $last = variable_get('update_last_check', 0); $output = theme('update_last_check', array('last' => $last)); if (!is_array($data)) { diff -u b/core/modules/update/update.settings.inc b/core/modules/update/update.settings.inc --- b/core/modules/update/update.settings.inc +++ b/core/modules/update/update.settings.inc @@ -12,12 +12,12 @@ * @see update_settings_submit() * @ingroup forms */ -function update_settings($form, $form_state) { +function update_settings($form, &$form_state) { $config = config('update.settings'); $form['update_check_frequency'] = array( '#type' => 'radios', '#title' => t('Check for updates'), - '#default_value' => $config->get('check.frequency'), + '#default_value' => $config->get('check.interval_days'), '#options' => array( '1' => t('Daily'), '7' => t('Weekly'), @@ -28,7 +28,7 @@ $form['update_check_disabled'] = array( '#type' => 'checkbox', '#title' => t('Check for updates of disabled modules and themes'), - '#default_value' => $config->get('check.disabled'), + '#default_value' => $config->get('check.disabled_extensions'), ); $notification_emails = $config->get('notification.emails'); @@ -107,15 +107,12 @@ // invalidate all cached update status data. - if ($form_state['values']['update_check_disabled'] != $config->get('check.disabled')) { + if ($form_state['values']['update_check_disabled'] != $config->get('check.disabled_extensions')) { _update_cache_clear(); } $config - ->set('check.disabled', $form_state['values']['update_check_disabled']) - ->set('check.frequency', $form_state['values']['update_check_frequency']) + ->set('check.disabled_extensions', $form_state['values']['update_check_disabled']) + ->set('check.interval_days', $form_state['values']['update_check_frequency']) ->set('notification.emails', $form_state['notify_emails']) ->set('notification.threshold', $form_state['values']['update_notification_threshold']) ->save(); - - unset($form_state['notify_emails']); - unset($form_state['values']['update_notify_emails']); } only in patch2: unchanged: --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -345,9 +345,10 @@ function update_module_add_to_system($modules = array()) { function update_fix_d8_requirements() { global $conf; - if (drupal_get_installed_schema_version('system') < 8000 && !variable_get('update_d8_requirements', FALSE)) { + $update_config = config('update.settings'); + if (drupal_get_installed_schema_version('system') < 8000 && !$update_config->get('d8_requirements')) { // @todo: Make critical, first-run changes to the database here. - variable_set('update_d8_requirements', TRUE); + $update_config->get('d8_requirements', TRUE)->save(); } } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php @@ -65,6 +65,7 @@ class UpdateScriptTest extends WebTestBase { * Tests that requirements warnings and errors are correctly displayed. */ function testRequirements() { + $update_script_test_config = config('update_script_test.settings'); $this->drupalLogin($this->update_user); // If there are no requirements warnings or errors, we expect to be able to @@ -81,7 +82,7 @@ class UpdateScriptTest extends WebTestBase { // First, run this test with pending updates to make sure they can be run // successfully. - variable_set('update_script_test_requirement_type', REQUIREMENT_WARNING); + $update_script_test_config->set('requirement_type', REQUIREMENT_WARNING)->save(); drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1); $this->drupalGet($this->update_url, array('external' => TRUE)); $this->assertText('This is a requirements warning provided by the update_script_test module.'); @@ -106,7 +107,7 @@ class UpdateScriptTest extends WebTestBase { // If there is a requirements error, it should be displayed even after // clicking the link to proceed (since the problem that triggered the error // has not been fixed). - variable_set('update_script_test_requirement_type', REQUIREMENT_ERROR); + $update_script_test_config->set('requirement_type', REQUIREMENT_ERROR)->save(); $this->drupalGet($this->update_url, array('external' => TRUE)); $this->assertText('This is a requirements error provided by the update_script_test module.'); $this->clickLink('try again'); only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/tests/modules/update_script_test/config/update_script_test.settings.yml @@ -0,0 +1 @@ +requirement_type: '0' \ No newline at end of file only in patch2: unchanged: --- a/core/modules/system/tests/modules/update_script_test/update_script_test.install +++ b/core/modules/system/tests/modules/update_script_test/update_script_test.install @@ -13,7 +13,7 @@ function update_script_test_requirements($phase) { if ($phase == 'update') { // Set a requirements warning or error when the test requests it. - $requirement_type = variable_get('update_script_test_requirement_type'); + $requirement_type = config('update_script_test.settings')->get('requirement_type'); switch ($requirement_type) { case REQUIREMENT_WARNING: $requirements['update_script_test'] = array( only in patch2: unchanged: --- /dev/null +++ b/core/modules/update/tests/modules/update_test/config/update_test.settings.yml @@ -0,0 +1,3 @@ +system_info: [] +update_status: [] +xml_map: '0' \ No newline at end of file only in patch2: unchanged: --- a/core/modules/update/tests/modules/update_test/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -42,7 +42,7 @@ function update_test_menu() { /** * Implements hook_system_info_alter(). * - * Checks the 'update_test_system_info' variable and sees if we need to alter + * Checks the 'system_info' setting and sees if we need to alter * the system info for the given $file based on the setting. The setting is * expected to be a nested associative array. If the key '#all' is defined, its * subarray will include .info keys and values for all modules and themes on the @@ -51,7 +51,7 @@ function update_test_menu() { * theme. */ function update_test_system_info_alter(&$info, $file) { - $setting = variable_get('update_test_system_info', array()); + $setting = config('update_test.settings')->get('system_info'); foreach (array('#all', $file->name) as $id) { if (!empty($setting[$id])) { foreach ($setting[$id] as $key => $value) { @@ -64,7 +64,7 @@ function update_test_system_info_alter(&$info, $file) { /** * Implements hook_update_status_alter(). * - * Checks the 'update_test_update_status' variable and sees if we need to alter + * Checks the 'update_status' setting and sees if we need to alter * the update status for the given project based on the setting. The setting is * expected to be a nested associative array. If the key '#all' is defined, its * subarray will include .info keys and values for all modules and themes on the @@ -72,7 +72,7 @@ function update_test_system_info_alter(&$info, $file) { * name and the subarrays contain settings just for that module or theme. */ function update_test_update_status_alter(&$projects) { - $setting = variable_get('update_test_update_status', array()); + $setting = config('update_test.settings')->get('update_status'); if (!empty($setting)) { foreach ($projects as $project_name => &$project) { foreach (array('#all', $project_name) as $id) { @@ -108,7 +108,7 @@ function update_test_update_status_alter(&$projects) { * @see update_test_menu() */ function update_test_mock_page($project_name) { - $xml_map = variable_get('update_test_xml_map', FALSE); + $xml_map = config('update_test.settings')->get('xml_map'); if (isset($xml_map[$project_name])) { $availability_scenario = $xml_map[$project_name]; }