1 node.module | node_requirements($phase) |
Implements hook_requirements().
File
- core/
modules/ node/ node.module, line 3577 - The core module that allows content to be submitted to the site.
Code
function node_requirements($phase) {
$requirements = array();
if ($phase === 'runtime') {
$needs_rebuild = node_access_needs_rebuild();
$grant_count = db_query('SELECT COUNT(*) FROM {node_access}')->fetchField();
// Show an error message if permissions need to be rebuilt. Otherwise
// show a permission count if there are either 0, or 2 or more, rows in the
// {node_access} table, or if there are modules that implement
// hook_node_grants().
if ($needs_rebuild) {
$value = t('Access permissions need to be rebuilt.');
}
elseif ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
}
else {
$value = t('Disabled');
}
$value .= ' (' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild') . ')';
if ($needs_rebuild) {
$description = t('Node access permissions need to be rebuilt.');
$severity = REQUIREMENT_ERROR;
}
else {
$description = t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache.');
$severity = REQUIREMENT_OK;
}
// Add further information.
$description .= ' ' . t('Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions.');
$requirements['node_access'] = array(
'title' => t('Node Access Permissions'),
'value' => $value,
'description' => $description,
'severity' => $severity
);
}
return $requirements;
}