diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index a4d1bd7..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. - variable_set('update_last_check', $now); + 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 14efc3a..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. - variable_del('update_last_check'); variable_del('update_last_email_notification'); $queue = queue('update_fetch_tasks'); @@ -162,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 5720af7..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 = variable_get('update_last_check', 0); + $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 d9aa464..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 - variable_get('update_last_check', 0)) > $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 409284a..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 = variable_get('update_last_check', 0); + $last = state()->get('update.last_check'); $output = theme('update_last_check', array('last' => $last)); if (!is_array($data)) {