function node_access_needs_rebuild

Same name and namespace in other branches
  1. 9 core/modules/node/node.module \node_access_needs_rebuild()
  2. 8.9.x core/modules/node/node.module \node_access_needs_rebuild()
  3. 10 core/modules/node/node.module \node_access_needs_rebuild()
  4. 11.x core/modules/node/node.module \node_access_needs_rebuild()

Flags or unflags the node access grants for rebuilding.

If the argument isn't specified, the current value of the flag is returned. When the flag is set, a message is displayed to users with 'access administration pages' permission, pointing to the 'rebuild' confirm form. This can be used as an alternative to direct node_access_rebuild calls, allowing administrators to decide when they want to perform the actual (possibly time consuming) rebuild. When unsure if the current user is an administrator, node_access_rebuild() should be used instead.

Parameters

$rebuild: (Optional) The boolean value to be written.

Return value

The current value of the flag if no value was provided for $rebuild.

See also

node_access_rebuild()

Related topics

5 calls to node_access_needs_rebuild()
module_disable in includes/module.inc
Disables a given set of modules.
node_access_rebuild in modules/node/node.module
Rebuilds the node access database.
node_help in modules/node/node.module
Implements hook_help().
node_modules_enabled in modules/node/node.module
Implements hook_modules_enabled().
_node_access_rebuild_batch_finished in modules/node/node.module
Implements callback_batch_finished().

File

modules/node/node.module, line 3591

Code

function node_access_needs_rebuild($rebuild = NULL) {
    if (!isset($rebuild)) {
        return variable_get('node_access_needs_rebuild', FALSE);
    }
    elseif ($rebuild) {
        variable_set('node_access_needs_rebuild', TRUE);
    }
    else {
        variable_del('node_access_needs_rebuild');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.