General help

Moodle for Windows stuck in Maintenance mode

 
Picture of Bill Galbraith
Moodle for Windows stuck in Maintenance mode
 

I have Moodle 2.6 for Windows installed on Windows 7. Everything was working fine, developed a couple courses. Put Moodle into Maintenance Mode, and now when I try to go back to localhost, I'm told that "The site is undergoing maintenance and is currently not available".

I've looked for maintenance.htm, and it's not present. I've tried shutting down Moodle server, rebooting the computer, no luck. I tried taking a nap, but that didn't help either (didn't hurt, though).

How to I get it back out of maintenance mode?

Thanks,

Bill

 
Average of ratings: -
Picture of Christian Herman
Re: Moodle for Windows stuck in Maintenance mode
 

I depends on how you enabled maintenance mode.

http://docs.moodle.org/26/en/Maintenance_mode

http://docs.moodle.org/26/en/Administration_via_command_line#Offline_mode

If you're seeing that message, you probably need to login to access the site.  There should be a login link in the upper right of the screen.  Just login and disable maintenancece mode

If you can't access the site at all then I assume you enabled maintenance mode via CLI.  If so, go to your data root directory (probably moodledata) and delete or rename the file climaintenance.html.

 
Average of ratings: -
Picture of Bill Galbraith
Re: Moodle for Windows stuck in Maintenance mode
 

I entered Maintenance mode through the menu Settings > Site administration > Server > Maintenance mode.

There is no login prompt on the localhost page. There is not a file called climaintenance.html anywhere in the directory structure, nor is there any *maintenance.htm* file.

 
Average of ratings: -
Picture of Christian Herman
Re: Moodle for Windows stuck in Maintenance mode
 

There is no maintenance.htm file that I'm aware of, so don't get hung up on that.

Does your theme include a page header that you've hidden or disabled?  I'm using a variant of the Formal White theme.  With maintenacne mode enabled, above the maintenance message in the upper left corner is my site logo.  In the upper right corner is the standard logged in identifier with a Login link.  These are both in the page header.  So if the header were hidden (as part of the theme) I'd be stuck and need to modify the theme to gain access.

 
Average of ratings: -
Picture of Ken Task
Re: Moodle for Windows stuck in Maintenance mode
Particularly helpful Moodlers

Behavior of maintenance mode has changed.  Using Moodle UI to set, means total lockout - including admins.  Read the comments in /moodlecode/admin/cli/maintenance.php file.

At this point two ways:

1. from command line and in moodlecode directory: php admin/cli/maintenance.php --disable

or if you don't have access to command line (nor care to use it)

2. edit config.php file and include the following line:

$CFG->maintenance_enabled=0;

That's a zero - which means off.

After you login as admin level user, go to the place where you turned it on and disable.

Then re-edit config.php and comment out that line by adding // in front.   May as well leave that line there commented out until this gets sorted out.

'spirit of sharing', Ken

 
Average of ratings: Useful (4)
Picture of Bill Galbraith
Re: Moodle for Windows stuck in Maintenance mode
 

That did it.

Thank you so much.

Bill

 
Average of ratings: -
Picture of Bill Galbraith
Re: Moodle for Windows stuck in Maintenance mode
 

Just for any that encounters this later, to clarify what Ken said, when you add that line in the config.php, it does then allow you to login. When you go to the Settings > Site administration > Server > Maintenance mode, you will see that it is disabled, and a comment says that it is disabled in the config.php. With that screen still open, you can then change and save the config.php file, and then enable and disable the Maintenance mode in MOodle, and that comment will go away.

 
Average of ratings: Useful (2)
Picture of Owen Grubbs
Re: Moodle for Windows stuck in Maintenance mode
 

Bill, thanks for the tip update (and the humor!).

 
Average of ratings: -
Picture of keith morgan
Re: Moodle for Windows stuck in Maintenance mode
 

Thank you Ken Task! 

I too became locked out as an admin.
I chose to edit the config.php file, as you specified. It worked perfectly.
Crisis averted; Friday night salvaged! Bueno!

Keith

 
Average of ratings: -
Picture of Marinda Faasen
Re: Moodle for Windows stuck in Maintenance mode
 

Thanks. It worked for me too.

Saturday night saved.

Just for interest sake: which theme are you using?

 
Average of ratings: -
Ed Beckmann
Re: Moodle for Windows stuck in Maintenance mode
 

Ken


I got stuck as well (though expected it for several reasons) and your rescue worked - many thanks.


For reference, when I commented out the extra line in config.php it reverted to maintenance again despite my changing settings in the admin interface as well. I'm in 2.7.2 on a LAMP setup.

Will update this post if I can fathom out why - it is not a big problem but I'm curious about it.

Thaks

Ed

 
Average of ratings: -
Picture of Ken Task
Re: Moodle for Windows stuck in Maintenance mode
Particularly helpful Moodlers

Entries in config.php override settings in DB mdl_config table - and thank goodness they do in this instance (otherwise, it's mysql query/edit and that's getting 'gu-ruish').

See: https://moodle.org/mod/forum/discuss.php?d=251954#p1092569

It's kinda a strange process to get things back to normal but the above response to this thread does tell how to get there.

One might have to go directly to the setting via the Moodle UI:

http://yoursite/admin/settings.php?section=maintenancemode

That should force you to login but then take you directly to the related settings.

'spirit of sharing', Ken

 
Average of ratings: -
Picture of Mark Hayes
Re: Moodle for Windows stuck in Maintenance mode
 

hi ken -

do you know if maintenance mode has been sorted out yet?
how are admin's supposed to access the moodle UI when moodle is in maintenance mode?

using moodle 2.7.2
thanks.

 
Average of ratings: -
Picture of Ken Task
Re: Moodle for Windows stuck in Maintenance mode
Particularly helpful Moodlers

If it's not 'sorted out' in Linux, it's not 'sorted out' in Windows. :\   It's same code either way, just that command line is something Linux users don't object to very often.  Now I don't admin any server that runs Windows (ok, call me a linux bigot ... I confess!).   But, how about the direct link shown on the 'work-around-links' @ http://sos.tcea.org/tsmoodle.html

To my way of thinking, even Windows server administrators should appreciate the scripts in admin/cli/ cause using them in combination with git, the scripts can be included in a powershell script (couldn't they?)  to run cron, backup the site code, do a mysql dump of the DB, put site in maintenance mode, pull new code via git, upgrade, and then take site out of maintenance mode.  One can literally update the moodle in a matter of minutes and browser/web services issues are taken out of the loop.

However, if one just has to stay in the GUI and browser, Moodle still allows two browser instances from the same user, right?   So .... launch one browser instance and take that instance to the page for enabling maintenance.   When saved the page stays there.  Don't click on anything.   Open another browser instance to do the GUI upgrade - http://site/admin/.   Heck, use Chrome or Firefox for that one cause there's no shared cookies/browser cache.   When completed, come back to the browser instance that has the maintenance form displayed where one can set it to disabled and save again.

Still have two fall backs ... editing of config.php file which doesn't require reboot or restart of anything ... just access via browser to Moodle login.   And, my last choice ... mysql editing of mdl_config table for the variable to disable maintenance.

Funny isn't it ... you see all the time in these forums folks recommending keeping Moodle up to date, but it isn't really easy for Admin users to do that .... hmmmmmmm - a little dis-connect there me thinks.   One of these days, Moodle will get to the level of WordPress/Joomla 2 or 3)/Webmin where updates/upgrades are built in to the admin interface.

We need some Windows scripting ace to put together and share a powershell script, huh?

'spirit of sharing', Ken





 
Average of ratings: -
Picture of Mark Hayes
Re: Moodle for Windows stuck in Maintenance mode
 

hi ken -
what i was trying to do was put moodle 2.7 in maintenance mode and still be able to log in as admin. i can now do it.

from the command line i used the --enableold option:
admin/cli/maintenance.php --enableold instead of
admin/cli/maintenance.php --enable

if i use this URL to access moodle, i get the login prompt:
<hostname>/moodle/login/index.php

if i use this URL i do not get the login prompt:
<hostname>/moodle/

have tested it and only admin accounts can log in.

 
Average of ratings: -
Picture of Ken Task
Re: Moodle for Windows stuck in Maintenance mode
Particularly helpful Moodlers

Excellent!   Thanks for 'sharing back'.   Am certain other Windows Admins will find the info useful.

Wonder when Moodle (IF) will start to follow other open source/community driven software like Kaltura.   The early versions of their community version included a rather long and involved PDF file with descriptions as to how to install all the dependencies (Windows translation: the old 'dll hell') needed to run Kaltura Community. All sorts of community support questions on those. Later versions (think the latest still) actually included a 'bin' directory and it included all the 'dependencies' ... ffmpeg, etc..

Know there exist Windows versions of wget, bash shell, and git, for example.  Wouldn't it be nice if folks were offered a larger download package that included those apps in a bin?   Hmmmm ... probably not possible due to licenses ... ie, what one could include legally.

Ya know the admin methods for maintenance mode still might change in future versions of Moodle.   So don't forget about those other options in the future.

'spirit of sharing', Ken


 
Average of ratings: -
Picture of Mark Hayes
Re: Moodle for Windows stuck in Maintenance mode
 

sorry, this was all done on Linux (ubuntu 14.04), not Windows. Should be the same I would think.
the --enableold option is documented in maintenance.php


 
Average of ratings: -
Picture of Ivan Rueda
Re: Moodle for Windows stuck in Maintenance mode
 

Excellent 'spirit', give you 100 points, and just for search engine, the translation in spanish, because I spend more than 5 hours looking for this procedure.


El comportamiento del modo mantenimiento ha cambiado. Usando Moodle UI para configurarlo, significa el total bloqueo  - incluyendo administradores. Lea los comentario en el archivo /moodlecode/admin/cli/maintenance.php

Si se encuentra en este punto (bloqueado en modo mantenimiento, sin poder acceder al logueo desde algún administrador), tiene dos vías:

1. desde la linea de comando y en el directorio moodlecode: php admin/cli/maintenance.php --disable


o si usted no tiene acceso a la linea de comando (o no le importa usarla)

2. edite el archivo config.php e incluya la siguiente linea:

$CFG->maintenance_enabled=0;

Es un 'cero', - que significa 'apagado'.

Luego de realizar su acceso como usuario administrador, vaya al lugar donde encendió el modo mantenimiento y apaguelo.

Posteriormente edite nuevamente el archivo config.php y comente la linea adicionando // (comentario en lenguaje php). Puede ser bueno dejar esta linea en caso que se pueda requerir nuevamente.

'spirit of sharing', Ken

 
Average of ratings: -
Picture of Mark Hayes
Re: Moodle for Windows stuck in Maintenance mode
 

When there is total lockout, ie, login button is not on the home page, you can still login by going to:

<moodle-url>/login/index.php

This works for me. Only an admin will be able to log in.

 
Average of ratings: -
Picture of Jake Connor
Re: Moodle for Windows stuck in Maintenance mode
 

I had the same issue of being in maintenance mode and not having the login button on my screen. (I got a little worried, but trusty google is always there when you need it.)

I don't know if there are any settings that you can do to nullify what I did to fix it or if this works on any other version (I am using Moodle 2.8). All I did was go to my Moodle url and add "/login". Which brought me to the login page and I was able to login as admin.

 
Average of ratings: -