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 ...
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::...
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 ...
4
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 # ...
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 ...
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....
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 ...
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 {{ ...
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` = ...
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
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(&$...
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, ...
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'...
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 ...
1
vote
Not allowing the user to access the website within the given time period
and welcome to StackExchange.
As stated in the comments on your question, you are essentially asking for Maintenance Mode, which is part of Drupal core. In your site, go to /admin/config/development/...
1
vote
Accepted
Disable "Operating in maintenance mode. Go online."
Drupal 8 version:
function mytheme_preprocess_status_messages(&$variables) {
if (\Drupal::state()->get('system.maintenance_mode')) {
$message_count = count($variables['message_list']['...
1
vote
Accepted
My Site goes to Maintenance spontaneously
The error came from the Backup & Migrate Module : I had an error when I wanted to access the "Schedule" folder.
When I unstalled the Module, the error disappeared.
1
vote
Accepted
Maintenance page being rendered as an entire page load after the main page load
I'm still waiting to see an answer to the question of what causes maintenance mode to be displaying messages. So I don't know specifically whether the recoverable fatal error (this issue) being thrown ...
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.
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 ...
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 ...
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
1
vote
Why is my website often put in maintenance mode by itself?
The problem is with the Backup and Migrate module. For some reason, sometimes something fails with the backup every once in a while. The problem is the site is put into maintenance mode, then the ...
1
vote
How to prevent users from adding content without putting the site into full maintenance mode?
You can also use the Rules module for this. If you don't have Rules enabled yet, you can pretty sure use it to implement lots of other features in your site. That will help to reduce the risk of your ...
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 ...
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 ...
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 ...
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%'
1
vote
How to put a site in maintenance mode by non-admin
For Drupal 7/8/9 you can use the module Custom Permissions for that.
You have to (Drupal ^8):
Install the module Custom Permissions
Go to settings page /admin/people/custom-permissions/list
Set the &...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
maintenance-mode × 1107 × 36
theming × 17
8 × 13
users × 12
updating × 11
6 × 6
drush × 6
cron × 5
database × 4
notifications × 4
routes × 3
caching × 3
multi-sites × 3
deployment × 3
files × 2
emails × 2
configuration × 2
debugging × 2
security × 2
backups × 2
commerce × 1
blocks × 1
ajax × 1
rules × 1