Updated: Comment #0
Problem/Motivation
At the moment whether or not your Drupal site is in maintenance mode is stored in the config system in the system.maintenance
object. This means that in order to keep your site in maintenance mode during a config import then you must import a file with enabled set to 1. Then once you've finished your import and made sure everything is ok you'll go to the form and take the site out of maintenance mode - which means we've created a unnecessary difference between the snapshot and active.
The converse is even more problematic. If you put your site into maintenance mode and then import config where the value is 0 a some point during the import your site will be taken out of maintenance mode! I think this makes this issue critical.
Proposed resolution
Move system.maintenance.enabled to the state system.
Remaining tasks
Review code
User interface changes
None
API changes
- if (Drupal::config('system.maintenance')->get('enabled')) {
+ if (Drupal::state()->get('system.maintenance_mode')) {
Comment | File | Size | Author |
---|---|---|---|
#5 | 2084339-2.patch | 13.22 KB | alexpott |
Comments
Comment #1
xjmI'm not entirely convinced this is critical, though it would make maintenance mode behave in a buggy fashion for sure. @alexpott suggested that maintenance mode behaving unreliably could have security implications. In any case it shouldn't be too hard to patch.
Comment #3
mtiftRelated: #1496458: Convert maintenance mode settings to configuration system
Comment #4
mtiftI'll take this one
Comment #5
alexpottHere's a patch
Comment #6
alexpott@mtift - really sorry I'd already written the patch and didn't notice your comment :(
Comment #7
catchYes, yes it is.
Comment #8
webchickAwesome, this makes total sense.
Tested manually and no problems.
Committed and pushed to 8.x. Thanks!