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

Command icon 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

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review

berdir made their first commit to this issue’s fork.

  • berdir committed d49bc295 on 8.x-1.x authored by mglaman
    Issue #3539165 by mglaman: Check if site is in maintenance mode before...
berdir’s picture

Status: Needs review » Fixed

I'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.

mglaman’s picture

It 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.