diff -u b/core/modules/node/node.install b/core/modules/node/node.install --- b/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -716,14 +716,10 @@ /** * Moves node cron last run time from variable to state. * - * @ingroup state_upgrade + * @ingroup config_upgrade */ function node_update_8009() { - // Only migrate the variable if it exists and is not the default value. - if ($cron_last = update_variable_get('node_cron_last', 0)) { - state()->set('node.cron_last', $cron_last); - } - update_variable_del('node_cron_last'); + update_variables_to_state(array('node_cron_last' =>'node.cron_last')); } /** diff -u b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2202,6 +2202,15 @@ } /** + * Moves cron last run time from variable to state. + * + * @ingroup config_upgrade + */ +function system_update_8033() { + update_variables_to_state(array('cron_last' => 'system.cron_last')); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ @@ -2215,19 +2224,6 @@ } /** - * Moves cron last run time from variable to state. - * - * @ingroup state_upgrade - */ -function system_update_8033() { - // Only migrate the variable if it exists and is not the default value. - if ($cron_last = update_variable_get('cron_last', 0)) { - state()->set('system.cron_last', $cron_last); - } - update_variable_del('cron_last'); -} - -/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php @@ -35,6 +35,14 @@ public function testSystemVariableUpgrade() { $expected_state = array(); + $expected_state['node.cron_last'] = array( + 'value' => 1304208000, + 'variable_name' => 'node_cron_last', + ); + $expected_state['system.cron_last'] = array( + 'value' => 1304208000, + 'variable_name' => 'cron_last', + ); $expected_state['update.last_check'] = array( 'value' => 1304208000, 'variable_name' => 'update_last_check', only in patch2: unchanged: --- a/core/modules/system/tests/upgrade/drupal-7.state.system.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.state.system.database.php @@ -19,3 +19,11 @@ ->key(array('name' => 'update_last_email_notification')) ->fields(array('value' => serialize(1304208000))) ->execute(); +db_merge('variable') + ->key(array('name' => 'node_cron_last')) + ->fields(array('value' => serialize(1304208000))) + ->execute(); +db_merge('variable') + ->key(array('name' => 'cron_last')) + ->fields(array('value' => serialize(1304208000))) + ->execute();