Moodle offers several different ways to update the software. The examples in this article assume you've followed the Moodle — Installing article which uses git to install. If so, you can continue to use git to update to the latest version.
Step 1 — Backup your website and database
It's highly recommended that you create a backup of your website files and database before making any changes. This way, you'll have a copy to revert to if necessary. The following links explain how to backup your website files and database.
Step 2 — Put your site into maintenance mode
Moodle's documentation states the following:
Before you begin upgrading your site, you should put it into maintenance mode to stop any non-admin users from logging in. Then you should wait for any currently running cron processes to complete before proceeding.
- Log into your Moodle site.
- Click Site administration in the left menu.
- Click the Server tab in the center menu.
- Under the Server section, click the link.
- On the Maintenance mode page, choose Enable from the dropdown.
- Click the Save changes button to save.
Step 3 — Use git to upgrade
If you followed the Moodle — Installing instructions, you previously used git to download Moodle. You can now use git again to update it. Moodle's documentation states that changes are available every Wednesday.
The Moodle development team performs integration and testing of fixed bugs every Monday and Tuesday. On Wednesday you can install all patches by updating your code. Check the shortlog to see if the official repository has been already updated or not.
- Log into your server via SSH.
- Navigate into your website directory. Make sure to change username to your Shell user.
[server]$ cd /home/username/example.com
- In your website directory, run the following command to update Moodle.
[server]$ git pull remote: Counting objects: 16, done. remote: Compressing objects: 100% (13/13), done. remote: Total 16 (delta 8), reused 11 (delta 3) Unpacking objects: 100% (16/16), done. From git://git.moodle.org/moodle b9371d7bf69..ccd4ef8ddd0 MOODLE_39_STABLE -> origin/MOODLE_39_STABLE a96a428c7df..598064e4d99 MOODLE_35_STABLE -> origin/MOODLE_35_STABLE b7a29558270..f6e37fe1953 MOODLE_37_STABLE -> origin/MOODLE_37_STABLE 472d293a16f..b21d86f807d MOODLE_38_STABLE -> origin/MOODLE_38_STABLE * [new tag] v3.5.14 -> v3.5.14 * [new tag] v3.7.8 -> v3.7.8 * [new tag] v3.8.5 -> v3.8.5 * [new tag] v3.9.2 -> v3.9.2 Updating b9371d7bf69..ccd4ef8ddd0 Fast-forward version.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
- Output displays as shown above.
- Log into your Moodle site.
- You will see text informing you that files need to be updated. Click the Continue button to proceed.
- The next page confirms your server meets all requirements. Click the Continue button.
- The next page is a Plugins check. Confirm all settings, then click Upgrade Moodle database now.
- The next page displays a success message. Click the Continue button.
- Another page may display asking you to confirm some Plugin settings. Click Save changes when finished.
Your Moodle site and plugins are now running the most recent version.