What does maintenance mode actually do? I'm not asking for a high level overview, nor am I asking for a code dump. I'm asking for a technical, functional definition. What does maintenance mode actually do? Does it shut down everything for all users except admin and just show them a static page?
Is there a technical reference (short of the code itself) that covers what maintenance mode actually does?
4 Answers
The main functionality of maintenance mode is that it allows the site to use the theme system without requiring the database.
It does almost exactly what you had guessed, it locks out all users that do not have the 'use site in maintenance mode' permissions or administrator roles. A site in maintenance mode will use a different template file than the live site, normally maintenance-page.tpl.php
.
Maintenance mode also kicks in in other situations:
- Site installation
- Updates
- Any time the database fails
-
So, when the site is in maintenance mode and no 'use site in MM' users are in, then I'm guaranteed that the db won't be accessed? (db backups are one of the reasons I asked the question)– AllenMar 12, 2015 at 3:23
-
Maintenance mode simply prevent anonymous users and authenticated users without the access site in maintenance mode from accessing the site. These users will only be able to view the special maintenance page. This prevents most reads and writes to/from the database and loading of most of Drupal and additional modules' code.
It just limits the users who can access the site to the ones with the access site in maintenance mode (Drupal 7 and 8) or administer site configuration (Drupal 6) permission.
It doesn't disconnect the database, but it limits the page being accessed to a strict number of users. Drupal will still connect to the database, but the access is very limited, since you don't normally give that permission to normal users.
Also the module's activity is reduced, even if modules are not blocked, although in Drupal 8 the only accessible routes are the ones explicitly stating to be accessible during maintenance. (In the routing.yml file, the module needs to set _maintenance_access
to TRUE
.)
Maintenance mode is more about disallowing unauthorized users from accessing the site. There's a permission in admin/people/permissions
that controls this access.
Maintenance mode also disables any theme for the site and sets a message for site users. That config can be found at /admin/config/development/maintenance
.
If a custom maintenance theme is needed, that'll have to be set in the settings.php file. To read more about this please see Drupal.org
When you run update.php, the site will briefly go into maintenance mode while it runs database updates. Same with drush updb
. It happens automatically without many users even noticing that it happens. Some modules such asRedirect or Advanced CSS/JS Aggregation check whether or not the site is in maintenance mode, probably in an effort to not pull in non-functioning code.
To read more about maintenance mode, read the Drupal Gardens post on maintenance mode.