diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index 53aabdc..773e3e2 100644 --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -186,7 +186,7 @@ function _update_process_fetch_task($project) { _update_cache_set('fetch_failures', $fail, $now + (60 * 5)); // Whether this worked or not, we did just (try to) check for updates. - config('update.settings')->set('check.last', $now)->save(); + state()->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. diff --git a/core/modules/update/update.install b/core/modules/update/update.install index 6ba05d6..202b865 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -77,8 +77,8 @@ function update_install() { * Implements hook_uninstall(). */ function update_uninstall() { + state()->delete('update.last_check'); // @todo D8: Convert to new state storage. - config('update.settings')->delete('check.last'); variable_del('update_last_email_notification'); $queue = queue('update_fetch_tasks'); @@ -155,7 +155,6 @@ function update_update_8000() { update_variables_to_config('update.settings', array( 'update_check_disabled' => 'check.disabled_extensions', 'update_check_frequency' => 'check.interval_days', - 'update_last_check' => 'check.last', 'update_fetch_url' => 'fetch.url', 'update_max_fetch_attempts' => 'fetch.max_attempts', 'update_max_fetch_time' => 'fetch.timeout', @@ -163,3 +162,17 @@ function update_update_8000() { 'update_notification_threshold' => 'notification.threshold', )); } + +/** + * Convert update_last_check variable to state api value. + * + * @ingroup state_upgrade + */ +function update_update_8001() { + $variable = 'update_last_check'; + + if ($value = update_variable_get($variable, FALSE)) { + state()->set('update.last_check', $value); + } + update_variable_del($variable); +} diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index c03bfc3..926d248 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -278,7 +278,7 @@ function update_manager_update_form($form, $form_state = array(), $context) { */ function theme_update_manager_update_form($variables) { $form = $variables['form']; - $last = config('update.settings')->get('check.last'); + $last = state()->get('update.last_check'); $output = theme('update_last_check', array('last' => $last)); $output .= drupal_render_children($form); return $output; diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 230027f..8eee677 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -285,7 +285,7 @@ function update_cron() { $update_config = config('update.settings'); $frequency = $update_config->get('check.interval_days'); $interval = 60 * 60 * 24 * $frequency; - if ((REQUEST_TIME - config('update.settings')->get('check.last')) > $interval) { + if ((REQUEST_TIME - state()->get('update.last_check')) > $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. diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 1045473..04287b5 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -33,7 +33,7 @@ function update_status() { function theme_update_report($variables) { $data = $variables['data']; - $last = config('update.settings')->get('check.last'); + $last = state()->get('update.last_check'); $output = theme('update_last_check', array('last' => $last)); if (!is_array($data)) {