You can place the site in read only mode by setting these configuration variables:
$CONFIG->siteReadOnly = true
$CONFIG->siteReadOnlyReason = "Upgrading"
If you are using the message que, stop any workers. See :doc:`message que documentation<installMessageQue>`
Backup the database contents and the file store folder, if used - check the "fileStoreLocation" configuration option.
Place the new files over the old ones. (If you have had to change any "localConfig.php" files to accomodate your webserver, be careful to preserve the changes.)
Run the PHP script "php core/cli/upgradeDatabase.php".
Run the PHP script "php core/cli/loadStaticData.php".
On servers not in Debug mode, delete the existing cached templates. These are found in "cache/templates.cli" and "cache/templates.web". (It doesn't hurt to do this on debug servers so if in doubt, just do it.)
If you have changed theme variables or are using custom extensions, you should :doc:`run the web asset compilation procedure again<webAssets>`.
There are Apache config files included in the software that turn on browser caching for assets, such as images, CSS and JS. This should help speed up subsequent page loads for users. However when you update, you must make sure users get the latest version of all assets. To do this, the asset version must be incremented.
Your config.php should contain this variable:
$CONFIG->assetsVersion = 1
This is set to 1 by default - increase it by 1 every time you perform an upgrade.
Set
$CONFIG->siteReadOnly = false
If you are using the message que, start new workers. See :doc:`message que documentation<installMessageQue>`
Following the upgrade procedure above means that there is a small period of time during which the code has been upgraded and the database hasn't. Users may see errors during that time.
This can be avoided. Database changes are designed to be additions that can be upgraded before the code is upgraded.
Check out the new code into a seperate folder. Give this folder the same config.php and extensions as your normal web app.
Then run the PHP scripts "php core/cli/upgradeDatabase.php" and "php core/cli/loadStaticData.php" from this seperate folder.
Now update the code in your normal web app. The new DB structure will be in place already; thus minimising downtime.