Deprecate \Drupal\path_alias\AliasManager::cacheClear() in favour of cachetags

Created on 30 July 2021, over 3 years ago
Updated 1 October 2024, 3 months ago

Problem/Motivation

On commit of #3224592-15: \Drupal\path_alias\AliasManager::cacheClear() can cause deprecations on PHP 8.1 and when set to NULL it tries to flush the cache but that's not possible β†’ it was suggested to discover ability to remove the method

to try to remove the cacheClear method and replace everything with cache tags, but seems optional.

Proposed resolution

- research
- figure out disruption and benefits
- update summary and create a patch

Remaining tasks

- discover replacement
- test performance
- decide

User interface changes

no

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

path.module

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mikeryan Murphysboro, IL, USA

    While we're here - what about setCacheKey() and writeCache()? These public methods are:

    1. Implemented in AliasManager
    2. Not defined in AliasManagerInterface
    3. Used in PathAliasSubscriber via a member defined as an instance of AliasManagerInterface

    In other words, if you were to implement your own alias manager using the interface without referencing the internals of the core implementation - it would blow up.

    No, I'm not actually trying to implement my own alias manager - I'm decorating AliasManager, and phpstan is (rightfully) unhappy with the situation:

      32     Method Drupal\me_performance\MePerformanceAliasManager::setCacheKey() has parameter $key with no type specified.
      33     Call to an undefined method Drupal\path_alias\AliasManagerInterface::setCacheKey().
      40     Call to an undefined method Drupal\path_alias\AliasManagerInterface::writeCache().
      53     Method Drupal\me_performance\MePerformanceAliasManager::cacheClear() has parameter $source with no type specified.
    

    These methods were originally defined in `CacheDecoratorInterface` - when that was deprecated β†’ , the methods probably should have been moved to `AliasManagerInterface`.

  • πŸ‡¬πŸ‡§United Kingdom catch

    πŸ“Œ AliasManager should use the current route match for outbound alias pre-loading cache keys Active affects this issue - if we do that, some of these methods might even go altogether.

  • πŸ‡ΊπŸ‡ΈUnited States mikeryan Murphysboro, IL, USA
Production build 0.71.5 2024