diff --git a/core/core.services.yml b/core/core.services.yml index 83aa80f..5871ab0 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -303,15 +303,12 @@ services: arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver'] path.alias_manager.cached: class: Drupal\Core\CacheDecorator\AliasManagerCacheDecorator + tags: + - { name: event_subscriber } arguments: ['@path.alias_manager', '@cache.path'] path.crud: class: Drupal\Core\Path\Path arguments: ['@database', '@event_dispatcher'] - path.crud_subscriber: - class: Drupal\Core\Path\PathCRUDSubscriber - tags: - - { name: event_subscriber } - arguments: ['@path.alias_manager.cached'] # The argument to the hashing service defined in services.yml, to the # constructor of PhpassHashedPassword is the log2 number of iterations for # password stretching. diff --git a/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php b/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php index cf46231..42a9cfd 100644 --- a/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php +++ b/core/lib/Drupal/Core/CacheDecorator/AliasManagerCacheDecorator.php @@ -9,11 +9,13 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\Path\PathEvents; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Class used by the PathSubscriber to get the system path and cache path lookups. */ -class AliasManagerCacheDecorator implements CacheDecoratorInterface, AliasManagerInterface { +class AliasManagerCacheDecorator implements CacheDecoratorInterface, AliasManagerInterface, EventSubscriberInterface { /** * @var \Drupal\Core\Path\AliasManagerInterface @@ -125,4 +127,17 @@ public function cacheClear() { $this->cache->delete($this->cacheKey); $this->aliasManager->cacheClear(); } + + /** + * Registers the methods in this class that should be listeners. + * + * @return array + * An array of event listener definitions. + */ + static function getSubscribedEvents() { + $events[PathEvents::UPDATE][] = array('cacheClear'); + $events[PathEvents::INSERT][] = array('cacheClear'); + $events[PathEvents::DELETE][] = array('cacheClear'); + return $events; + } } diff --git a/core/lib/Drupal/Core/Path/AliasManagerInterface.php b/core/lib/Drupal/Core/Path/AliasManagerInterface.php index cbeb071..3dedd3e 100644 --- a/core/lib/Drupal/Core/Path/AliasManagerInterface.php +++ b/core/lib/Drupal/Core/Path/AliasManagerInterface.php @@ -54,10 +54,4 @@ public function getPathLookups(); * An array of system paths. */ public function preloadPathLookups(array $path_list); - - - /** - * Clear internal caches in alias manager. - */ - public function cacheClear(); } diff --git a/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php b/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php deleted file mode 100644 index 1f4ceef..0000000 --- a/core/lib/Drupal/Core/Path/PathCRUDSubscriber.php +++ /dev/null @@ -1,53 +0,0 @@ -aliasManager = $alias_manager; - } - - /** - * Clears internal cache in alias manager on path alias CRUD events. - */ - public function clearAliasManagerCaches() { - $this->aliasManager->cacheClear(); - } - - /** - * Registers the methods in this class that should be listeners. - * - * @return array - * An array of event listener definitions. - */ - static function getSubscribedEvents() { - $events[PathEvents::UPDATE][] = array('clearAliasManagerCaches'); - $events[PathEvents::INSERT][] = array('clearAliasManagerCaches'); - $events[PathEvents::DELETE][] = array('clearAliasManagerCaches'); - return $events; - } -}