Problem/Motivation
\Drupal\redirect\RedirectChecker::canRedirect checks the user permission to see if they can access maintenance mode even if the site is not in maintenance mode. This triggers the access policy processor. We can avoid this by adjusting the logic to first see if the site is in maintenance mode and avoid permission checks.
Steps to reproduce
Proposed resolution
Flip the logic so ($this->state->get('system.maintenance_mode') || defined('MAINTENANCE_MODE')) is evaluated first.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork redirect-3539165
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mglamanComment #6
berdirI'm not exactly happy that permission checks became expensive, or at least the first, but I guess that's the price of the flexibility.
Merged.
Comment #7
mglamanIt isn't too expensive, but this does help avoid a call to the cache backend from the access policy variation cache. Thanks for the merge!