Skip to main content
15 votes
Accepted

Drupal 8 maintenance page theming

In Drupal 8, settings.php contains the following line: # $settings['maintenance_theme'] = 'bartik'; First, uncomment this setting and change "bartik" to the machine name of your custom theme. Next, ...
Shawn Conn's user avatar
  • 26.9k
7 votes

How do I serve up a themed 500 error response page?

You may create custom exception subscriber as it is shown below. Notice that I did not use Drupal theming engine to render the error page. Uncaught exception indicates that something really wrong has ...
ya.teck's user avatar
  • 5,632
5 votes
Accepted

How do I check if the site is in maintenance mode?

From a procedural hook you'll probably need to use something like: use Drupal\Core\Routing\RouteMatch; ... $maintenance_mode = \Drupal::service('maintenance_mode'); $route_match = RouteMatch::...
Clive's user avatar
  • 167k
5 votes
Accepted

Is it normal that a site changes to maintenance mode during a module update?

It does look to be normal, yes. Drush's UpdateDBCommands::updateBatch, which is responsible for processing the updates, contains this: batch_set($batch); // See updateFinished() for the restore of ...
Clive's user avatar
  • 167k
4 votes

How can get my site out of maintenance mode?

Just go to /user/login, it works even in maintenance mode, and then sign in as an admin.
Dmitriy's user avatar
  • 141
3 votes

Where is the maintenance mode value in the database?

For Drupal 8 and 9: First check the system.maintenance_mode value: SELECT `value` FROM `key_value` WHERE `name` = 'system.maintenance_mode' Then update the value: UPDATE `key_value` SET `value` = ...
Kota Komputer CEO's user avatar
3 votes

What does maintenance mode do?

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 ...
Pierre Buyle's user avatar
  • 11.4k
3 votes
Accepted

Get out of maintenance mode using database query (without using drush or admin area)

It's never the best idea to manipulate the database directly (for the usual reasons), but if you're out of other options, it's not that unsafe: UPDATE key_value SET value = '<value>' WHERE ...
Clive's user avatar
  • 167k
3 votes

Is there a way to run drush updb without going to maintenance mode

Actually, if you take a look at the drush code for updatedb command, you can find this piece of code in updateBatch() function: $original_maint_mode = \Drupal::service('state')->get('system....
misterdidi's user avatar
  • 1,051
3 votes

Is there a way to run drush updb without going to maintenance mode

No. The critical path for drush updb is through: update_main() drush_update_batch() Where drush_update_batch() toggles the maintenance mode state prior to processing the updates needed to be ...
Shawn Conn's user avatar
  • 26.9k
3 votes
Accepted

How can I exclude certain routes from maintenance mode?

You need to override the service directly. mymodule.services.yml services: maintenance_mode: # same ID as declared in core.services.yml class: Drupal\mymodule\Services\CustomMaintenanceMode # ...
No Sssweat's user avatar
  • 31.3k
3 votes
Accepted

How can I render a specific node as the content for the maintenance page?

Use the Twig tweak module and create an overwrite template for maintenance-page.html.twig. Then copy & paste stuff from your base theme, but replace {{ page.content }} from the base theme with {{ ...
Hudri's user avatar
  • 5,500
2 votes

How can get my site out of maintenance mode?

Using Drush in D8, one can do: drush state-set system.maintenance_mode 0 To turn maintenance mode back on: drush state-set system.maintenance_mode 1
colan's user avatar
  • 2,169
2 votes

What does maintenance mode do?

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 ...
apaderno's user avatar
  • 97.5k
2 votes

How do I turn off maintenance mode?

With the latest version of Drush/Drupal the command has changed: drush state:set system.maintenance_mode 0 --input-format=integer drush cache:rebuild Drupal documentation
Damien LAGUERRE's user avatar
2 votes
Accepted

How do I set the title tag for the maintenance page?

TEMPLATE_preprocess_maintenance_page changes only variables for maintenance-page.html.twig. But <title> is outputted in html.html.twig, so you have to choose another preprocessor ...
Maria Kvitova's user avatar
2 votes
Accepted

hook for maintenance mode

As @Clive said you can use hook_form_alter() or hook_form_FORM_ID_alter() and add extra submit handler to send email notifications. function YOURMODULE_form_system_site_maintenance_mode_alter(&$...
Ajay Reddy's user avatar
  • 3,849
2 votes
Accepted

Can a site be put in maintenance mode without a database?

What you're describing should work: the maintenance-page--offline.tpl.php template should be called when the database is unavailable. Drupal does not bootstrap completely when there is no database, ...
Frank H.'s user avatar
  • 804
2 votes

How do I view the maintenance page without putting the site in maintenance mode?

Another way to do it is to add the following code to your settings.php file if (isset($_GET['maintenance'])) { $conf['maintenance_mode'] = TRUE; } Then go-to 'your_domain/?maintenance=1' and you'...
Adeleke Akinade's user avatar
2 votes
Accepted

Maintenance mode and user session

This is intended behavior, if user does not have "access site in maintenance mode" permission, then user is logged out. For Drupal 7 take look on user_menu_site_status_alter For Drupal 8 take look ...
quex's user avatar
  • 687
1 vote
Accepted

Where is the maintenance mode value in the database?

It's no longer a part of the config system; it's a part of the state system which is stored in the key_value table as a part of the state collection.
Shawn Conn's user avatar
  • 26.9k
1 vote

error 500 when D8 site placed in maintenance

BEGINNER VERSION Maintenance mode is working in general. Use the following direction of debugging: FROM "untouched" Drupal TO your state. Download a same core version of Drupal as you have. Turn on ...
ssibal's user avatar
  • 3,165
1 vote
Accepted

Migration after server crash: maintenance mode and/or cache problem

Here is finally how I solved the problem with Yogesh help: when I tried to access the admin section while logged in as an administrator, I got an error. I therefore checked the watchdog table. The ...
MBR's user avatar
  • 111
1 vote

How can I login to my local drupal site 8.3.1 which was under maintence mode

You can also try to login by enter below url. http://example.com/?q=admin or http://example.com/user
mvd's user avatar
  • 113
1 vote

How can get my site out of maintenance mode?

On Drupal 8 If your drush does not have access to mysql but you have access to mysql console you could try this UPDATE `key_value` SET `value` = 'i:0;' WHERE `name` LIKE '%maintenance_mode%'
Alex Kuzava's user avatar
  • 1,076
1 vote
Accepted

How to put up a notification about scheduled maintenance?

Reduce the risk of "modulitis" As an alternative to the Scheduled Maintenance module, suggested in the previous answer, you can also use the Rules module for this. Instead of installing yet another ...
Pierre.Vriens's user avatar
1 vote

How to put up a notification about scheduled maintenance?

Drupal Core has in built option to put site on maintenance but out of the box it does not have option to show maintenance message prior to scheduled date. In order to do that you can Scheduled ...
arpitr's user avatar
  • 7,836
1 vote

Updated to Drupal 7.51 and website is now stuck in maintenance mode

I am compiling here some points which I found. Following list I have ordered them from common to complex solution. 1. Clear cache: First thing you can do is clear the cache. If you read the forum ...
CodeNext's user avatar
  • 3,729
1 vote

Should the maintenance template be used when the database API raises an exception?

This looks to be the case of where the documentation is out-of-date. That comment has been around verbatim since D7. D8 doesn't produce a themed maintenance page like D7. When looking at ...
Shawn Conn's user avatar
  • 26.9k

Only top scored, non community-wiki answers of a minimum length are eligible