function node_access_rebuild in Drupal 5
Same name and namespace in other branches
- 8 core/modules/node/node.module \node_access_rebuild()
- 6 modules/node/node.module \node_access_rebuild()
- 7 modules/node/node.module \node_access_rebuild()
- 9 core/modules/node/node.module \node_access_rebuild()
- 10 core/modules/node/node.module \node_access_rebuild()
Rebuild the node access database. This is occasionally needed by modules that make system-wide changes to access levels.
Related topics
1 call to node_access_rebuild()
- node_configure_rebuild_confirm_submit in modules/
node/ node.module - Handler for wipe confirmation
File
- modules/
node/ node.module, line 3014 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Code
function node_access_rebuild() {
db_query("DELETE FROM {node_access}");
// only recalculate if site is using a node_access module
if (count(module_implements('node_grants'))) {
// If not in 'safe mode', increase the maximum execution time:
if (!ini_get('safe_mode')) {
set_time_limit(240);
}
$result = db_query("SELECT nid FROM {node}");
while ($node = db_fetch_object($result)) {
$loaded_node = node_load($node->nid, NULL, TRUE);
// To preserve database integrity, only aquire grants if the node
// loads successfully.
if (!empty($loaded_node)) {
node_access_acquire_grants($loaded_node);
}
}
}
else {
// not using any node_access modules. add the default grant.
db_query("INSERT INTO {node_access} VALUES (0, 0, 'all', 1, 0, 0)");
}
cache_clear_all();
}