Search code examples
phpdatabasedrupal-7maintenance-mode

Site stuck in Maintenance mode in Drupal 7


My site is developed in Drupal 7. Recently I have put my site to maintenance mode. And now I need to put this site back to live.

Unfortunately I am not able to login as admin and 'Go Online'(Because of some modifications in the user login form). I have also tried to update the 'site_offline' variable by database query. But this also did not work. To my surprise, there was no variable like 'site_offline' in db. Why is this so?

Can anybody help to get this issue solved? Any help or suggestions will be a greatly appreciated.


Solution

  • Finally I have found a workaround for this problem. I logged in to the application by admin programmatically using below code,

    global $user;
    $user = user_load(1);
    drupal_session_regenerate();
    drupal_goto('user');
    

    Reference

    After getting logged in, I changed the maintenance configuration from admin/config/development/maintenance.

    UPDATE

    Please make sure to delete the above code once the site is set back from maintenance mode. Otherwise this will give administration access to any user visiting the website.