Commit 49689cf0 authored by alexpott's avatar alexpott

Issue #2106783 by bneil: Move node_requirements() to node.install.

parent 91d867f5
......@@ -8,6 +8,33 @@
use Drupal\Component\Uuid\Uuid;
use Drupal\Core\Language\Language;
/**
* Implements hook_requirements().
*/
function node_requirements($phase) {
$requirements = array();
if ($phase === 'runtime') {
// Only show rebuild button 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().
$grant_count = \Drupal::entityManager()->getAccessController('node')->countGrants();
if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
}
else {
$value = t('Disabled');
}
$description = t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. 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 . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild'),
);
}
return $requirements;
}
/**
* Implements hook_schema().
*/
......
......@@ -1977,33 +1977,6 @@ function _node_access_rebuild_batch_finished($success, $results, $operations) {
* @} End of "defgroup node_access".
*/
/**
* Implements hook_requirements().
*/
function node_requirements($phase) {
$requirements = array();
if ($phase === 'runtime') {
// Only show rebuild button 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().
$grant_count = \Drupal::entityManager()->getAccessController('node')->countGrants();
if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
}
else {
$value = t('Disabled');
}
$description = t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. 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 . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild'),
);
}
return $requirements;
}
/**
* Implements hook_modules_installed().
*/
......
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