7

Does anyone know how to turn off maintenance mode for brainfx? I tried http://www.website.com/?q=user/login but that gives me a blank page (no html source or anything). I tried the following query.

UPDATE `variable` SET `value`='0' WHERE 'name' = 'maintenance_mode';

It didn't affect any records.

I tried to find a $conf['maintenance_mode'] variable in the project, but it doesn't exist. Adding that $conf['maintenance_mode'] = false; in setting.php didn't do anything either.

How do I turn off maintenance mode?

18

Try using Drush:

drush vset maintenance_mode 0
  • and if for some dark reason we are on Windows server, Drush is not available. Is it? – Meloman Feb 15 '18 at 13:19
14

The answer by schnippy is correct; however, some details are wrong, at least in Drupal 7.28.

The query to change maintenance_mode should be:

UPDATE variable SET value = 'i:0;' WHERE name= 'maintenance_mode';

The value is an integer, even if a string might work as well. It's just not what Drupal itself uses.

More importantly, in order to reset the cache for maintenance_mode, the table to use is cache_bootstrap.

DELETE FROM cache_bootstrap WHERE cid = 'variables';

There is no cache with ID equal to variables, inside the cache table.

This is tested and works with Drupal 7.28.

  • 1
    This is correct. Although the serialized string will also generally work because this value is usually checked using the equals operator instead of the identical one this way is safer. – rooby Nov 17 '14 at 5:26
6

You're on the right track with the database approach but your query is wrong since the variables are serialized. The actual syntax is:

UPDATE variable SET value = 's:1:"0";' WHERE name= 'maintenance_mode';

Also - its a good idea to follow this by flushing the variables cache:

DELETE FROM cache WHERE cid = 'variables';
  • 1
    +1 for the suggestion of flushing the cache, since the values of persistent variables are cached. – kiamlaluno Jan 22 '14 at 21:36
5

Maintenance mode is triggered by the variable "maintenance_mode", which is set to 1 when activated.

This is the code present in the System module (system.admin.inc, line 2194).

/**
 * Form builder; Configure the site's maintenance status.
 *
 * @ingroup forms
 * @see system_settings_form()
 */
function system_site_maintenance_mode() {
  $form['maintenance_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put site into maintenance mode'),
    '#default_value' => variable_get('maintenance_mode', 0),
    '#description' => t('When enabled, only users with the "Use the site in maintenance mode" <a href="@permissions-url">permission</a> are able to access your site to perform maintenance; all other visitors see the maintenance mode message configured below. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => url('admin/people/permissions'), '@user-login' => url('user'))),
  );
  $form['maintenance_mode_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Maintenance mode message'),
    '#default_value' => variable_get('maintenance_mode_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))),
    '#description' => t('Message to show visitors when the site is in maintenance mode.')
  );

  return system_settings_form($form);
}

You can use drush to disable maintenance mode.

drush vset maintenance_mode 0;
drush cc all;

You can also use variable_set('maintenance_mode', 0) and clear cache afterwards (with a call to cache_clear_all()).

  • 1
    Drush for everything :) I'm glad you added the drush command to do it. – inertialmedia Jan 23 '14 at 2:47
1

I had the same issue, however: every solution here above mentioned didn't work. the only thing that solved it to me was running the cron:

  • Logging in to the site with the Admin user
  • Go to the Menu Configuration -> Cron -> Run cron.

after that site was back up.

0

If you remember your username and password, login from http://www.example.com/?q=user. Then go to Configuration >> Maintenance mode; uncheck Put site into maintenance mode, and save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.