Commit bb316983 authored by webchick's avatar webchick
Browse files

Issue #1798804 by Albert Volkman, tayzlor, alexpott: Convert...

Issue #1798804 by Albert Volkman, tayzlor, alexpott: Convert node_access_needs_rebuild() to state system .
parent 49d6255e
...@@ -485,7 +485,7 @@ function node_uninstall() { ...@@ -485,7 +485,7 @@ function node_uninstall() {
variable_del('node_rank_recent'); variable_del('node_rank_recent');
// Delete remaining general module variables. // Delete remaining general module variables.
variable_del('node_access_needs_rebuild'); state()->delete('node.node_access_needs_rebuild');
variable_del('node_admin_theme'); variable_del('node_admin_theme');
variable_del('node_cron_last'); variable_del('node_cron_last');
variable_del('node_recent_block_count'); variable_del('node_recent_block_count');
...@@ -719,6 +719,15 @@ function node_update_8009() { ...@@ -719,6 +719,15 @@ function node_update_8009() {
update_variables_to_config('node.settings', array('default_nodes_main' => 'items_per_page')); update_variables_to_config('node.settings', array('default_nodes_main' => 'items_per_page'));
} }
/**
* Moves node_access_needs_rebuild from variable to state.
*
* @ingroup config_upgrade
*/
function node_update_8009() {
update_variables_to_state(array('node_access_needs_rebuild' => 'node.node_access_needs_rebuild'));
}
/** /**
* @} End of "addtogroup updates-7.x-to-8.x" * @} End of "addtogroup updates-7.x-to-8.x"
* The next series of updates should start at 9000. * The next series of updates should start at 9000.
......
...@@ -3219,13 +3219,13 @@ function _node_access_write_grants(Node $node, $grants, $realm = NULL, $delete = ...@@ -3219,13 +3219,13 @@ function _node_access_write_grants(Node $node, $grants, $realm = NULL, $delete =
*/ */
function node_access_needs_rebuild($rebuild = NULL) { function node_access_needs_rebuild($rebuild = NULL) {
if (!isset($rebuild)) { if (!isset($rebuild)) {
return variable_get('node_access_needs_rebuild', FALSE); return state()->get('node.node_access_needs_rebuild') ?: FALSE;
} }
elseif ($rebuild) { elseif ($rebuild) {
variable_set('node_access_needs_rebuild', TRUE); state()->set('node.node_access_needs_rebuild', TRUE);
} }
else { else {
variable_del('node_access_needs_rebuild'); state()->delete('node.node_access_needs_rebuild');
} }
} }
......
...@@ -35,6 +35,10 @@ public function testSystemVariableUpgrade() { ...@@ -35,6 +35,10 @@ public function testSystemVariableUpgrade() {
$expected_state = array(); $expected_state = array();
$expected_state['node.node_access_needs_rebuild'] = array(
'value' => TRUE,
'variable_name' => 'node_access_needs_rebuild',
);
$expected_state['update.last_check'] = array( $expected_state['update.last_check'] = array(
'value' => 1304208000, 'value' => 1304208000,
'variable_name' => 'update_last_check', 'variable_name' => 'update_last_check',
......
...@@ -19,3 +19,7 @@ ...@@ -19,3 +19,7 @@
->key(array('name' => 'update_last_email_notification')) ->key(array('name' => 'update_last_email_notification'))
->fields(array('value' => serialize(1304208000))) ->fields(array('value' => serialize(1304208000)))
->execute(); ->execute();
db_merge('variable')
->key(array('name' => 'node_access_needs_rebuild'))
->fields(array('value' => serialize(TRUE)))
->execute();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment