diff --git a/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php b/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php index cf46231..af48f76 100644 --- a/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php +++ b/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php @@ -121,8 +121,8 @@ public function preloadPathLookups(array $path_list) { /** * {@inheritdoc} */ - public function cacheClear() { + public function cacheClear($source = NULL) { $this->cache->delete($this->cacheKey); - $this->aliasManager->cacheClear(); + $this->aliasManager->cacheClear($source); } } diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php index 39e84a5..164d08f 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -124,13 +124,20 @@ public function getPathAlias($path, $path_language = NULL) { /** * Implements \Drupal\Core\Path\AliasManagerInterface::cacheClear(). */ - public function cacheClear() { - $this->lookupMap = array(); + public function cacheClear($source = NULL) { + if ($source) { + foreach (array_keys($this->lookupMap) as $lang) { + $this->lookupMap[$lang][$source]; + } + } + else { + $this->lookupMap = array(); + } $this->noSource = array(); $this->no_aliases = array(); $this->firstCall = TRUE; $this->preloadedPathLookups = array(); - $this->pathAliasWhitelistRebuild(); + $this->pathAliasWhitelistRebuild($source); } /** diff --git a/core/lib/Drupal/Core/Path/AliasManagerInterface.php b/core/lib/Drupal/Core/Path/AliasManagerInterface.php index e9920fb..10fe4fa 100644 --- a/core/lib/Drupal/Core/Path/AliasManagerInterface.php +++ b/core/lib/Drupal/Core/Path/AliasManagerInterface.php @@ -57,6 +57,10 @@ public function preloadPathLookups(array $path_list); /** * Clear internal caches in alias manager. + * + * @param $source + * Source path of the alias that is being inserted/updated. Can be ommitted + * if entire cache needs to be flushed. */ - public function cacheClear(); + public function cacheClear($source = NULL); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/MockAliasManager.php b/core/modules/system/lib/Drupal/system/Tests/Routing/MockAliasManager.php index 4523d70..3d8d737 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Routing/MockAliasManager.php +++ b/core/modules/system/lib/Drupal/system/Tests/Routing/MockAliasManager.php @@ -93,7 +93,7 @@ public function preloadPathLookups(array $path_list) { /** * {@inheritdoc} */ - public function cacheClear() { + public function cacheClear($source = NULL) { // Not needed. } }