diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index cbe7973..12cbf2d 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -27,17 +27,17 @@ class NodeAccessController extends EntityAccessController implements EntityContr /** * The node grant storage. * - * @var \Drupal\node\NodeGrandStorageControllerInterface + * @var \Drupal\node\NodeGrantStorageControllerInterface */ protected $grantStorage; /** * Constructs a NodeAccessController object. * - * @param \Drupal\node\NodeGrandStorageControllerInterface $grant_storage + * @param \Drupal\node\NodeGrantStorageControllerInterface $grant_storage * The node grant storage. */ - public function __construct(NodeGrandStorageControllerInterface $grant_storage) { + public function __construct(NodeGrantStorageControllerInterface $grant_storage) { $this->grantStorage = $grant_storage; } diff --git a/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php index e498fb0..079ac2a 100644 --- a/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php @@ -22,7 +22,7 @@ * * This is used to build node query access. */ -class NodeGrantStorageController implements NodeGrandStorageControllerInterface, EntityControllerInterface { +class NodeGrantStorageController implements NodeGrantStorageControllerInterface, EntityControllerInterface { /** * The database connection. @@ -261,4 +261,11 @@ public function nodeAccessDefaultGrant() { ->execute(); } + /** + * {@inheritdoc} + */ + public function countNodeGrants() { + return $this->database->query('SELECT COUNT(*) FROM {node_access}')->fetchField(); + } + } diff --git a/core/modules/node/lib/Drupal/node/NodeGrantStorageControllerInterface.php b/core/modules/node/lib/Drupal/node/NodeGrantStorageControllerInterface.php index 3b50dce..1879c24 100644 --- a/core/modules/node/lib/Drupal/node/NodeGrantStorageControllerInterface.php +++ b/core/modules/node/lib/Drupal/node/NodeGrantStorageControllerInterface.php @@ -117,4 +117,12 @@ public function nodeAccessDefaultGrant(); */ public function accessGrants(EntityInterface $node, $operation, $langcode, AccountInterface $account); + /** + * Count available node grants. + * + * @return int + * Returns the amount of node grants. + */ + public function countNodeGrants(); + } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 160a4c5..1eab2df 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2660,7 +2660,7 @@ function node_requirements($phase) { // 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::entityQuery('node')->count()->execute(); + $grant_count = Drupal::entityManager()->getController('node', 'grant_storage')->countNodeGrants(); if ($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)); }