Site stuck at upgrade running

For example you might see this message:

!!! Site is being upgraded, please retry later. !!!

Whenever a site upgrade is triggered, an entry is added into the database in the mdl_config table:

name=upgraderunning value=unixtimestamp that the upgrade was started

This is by design and deliberate to prevent changes to the site while things are being upgraded.

However if you ever have a site stuck indefinitely on upgrade, you might need to clear this out of the DB. At least check for the value in mdl_config but be careful here, you may break things if you clear out an upgrade that is still running somewhere in the background.

Don’t forget to clear your moodle cache if you do make a change to the mdl_config table.