Commit bb316983 authored by webchick's avatar webchick

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() {
variable_del('node_rank_recent');
// 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_cron_last');
variable_del('node_recent_block_count');
......@@ -719,6 +719,15 @@ function node_update_8009() {
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"
* The next series of updates should start at 9000.
......
......@@ -3219,13 +3219,13 @@ function _node_access_write_grants(Node $node, $grants, $realm = NULL, $delete =
*/
function node_access_needs_rebuild($rebuild = NULL) {
if (!isset($rebuild)) {
return variable_get('node_access_needs_rebuild', FALSE);
return state()->get('node.node_access_needs_rebuild') ?: FALSE;
}
elseif ($rebuild) {
variable_set('node_access_needs_rebuild', TRUE);
state()->set('node.node_access_needs_rebuild', TRUE);
}
else {
variable_del('node_access_needs_rebuild');
state()->delete('node.node_access_needs_rebuild');
}
}
......
......@@ -35,6 +35,10 @@ public function testSystemVariableUpgrade() {
$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(
'value' => 1304208000,
'variable_name' => 'update_last_check',
......
......@@ -19,3 +19,7 @@
->key(array('name' => 'update_last_email_notification'))
->fields(array('value' => serialize(1304208000)))
->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