diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php index c3809db..e9692c5 100644 --- a/core/lib/Drupal/Core/Routing/RouteBuilder.php +++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php @@ -121,22 +121,6 @@ public function __construct(MatcherDumperInterface $dumper, LockBackendInterface } /** - * Refreshes the local cache and rechecks if a rebuild is needed. - * - * @return bool - * TRUE if the rebuild is needed, FALSE otherwise. - */ - protected function isRebuildNeededUncached() { - // To absolutely ensure that the router rebuild is required, reset the cache - // in case they were set by another process. - $this->routeBuilderIndicator->resetCache(); - if ($this->routeBuilderIndicator->isRebuildNeeded()) { - return TRUE; - } - return FALSE; - } - - /** * {@inheritdoc} */ public function rebuild() { @@ -150,7 +134,7 @@ public function rebuild() { // available, resulting in a 404. $this->lock->wait('router_rebuild'); - if ($this->isRebuildNeededUncached()) { + if ($this->routeBuilderIndicator->isRebuildStillNeeded()) { $this->rebuild(); } @@ -236,7 +220,7 @@ public function getCollectionDuringRebuild() { */ public function rebuildIfNeeded() { if ($this->routeBuilderIndicator->isRebuildNeeded()) { - if (!$this->isRebuildNeededUncached()) { + if (!$this->routeBuilderIndicator->isRebuildStillNeeded()) { return FALSE; } return $this->rebuild(); diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php index 5cff225..77859e0 100644 --- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php +++ b/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php @@ -48,6 +48,19 @@ public function setRebuildNeeded() { /** * {@inheritdoc} */ + public function isRebuildStillNeeded() { + // To absolutely ensure that the router rebuild is required, reset the cache + // in case they were set by another process. + $this->resetCache(); + if ($this->isRebuildNeeded()) { + return TRUE; + } + return FALSE; + } + + /** + * {@inheritdoc} + */ public function isRebuildNeeded() { return $this->state->get(static::REBUILD_NEEDED, FALSE); } diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php index da9f97b..4b73af3 100644 --- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php +++ b/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php @@ -29,6 +29,14 @@ public function resetCache(); public function setRebuildNeeded(); /** + * Refreshes the local cache and rechecks if a rebuild is needed. + * + * @return bool + * TRUE if the rebuild is needed, FALSE otherwise. + */ + public function isRebuildStillNeeded(); + + /** * Sets the router rebuild indicator to FALSE. */ public function setRebuildDone();