Updating MediaWiki: Difference between revisions

From ULYSSIS documentation
Line 10: Line 10:
If you don't have an email from our Software Version Checker, you can find your current MediaWiki version by going to the <code>Special:Version#Installed_software</code> page on your wiki. For example, for this wiki, you can find the current version at [[Special:Version#Installed_software]].
If you don't have an email from our Software Version Checker, you can find your current MediaWiki version by going to the <code>Special:Version#Installed_software</code> page on your wiki. For example, for this wiki, you can find the current version at [[Special:Version#Installed_software]].


A table of all recent MediaWiki versions can be found on the [https://www.mediawiki.org/wiki/Version_lifecycle#Versions_and_their_end-of-life the official table]. In this table, currently supported versions are in '''bold'''.
A table of all recent MediaWiki versions can be found on the [https://www.mediawiki.org/wiki/Version_lifecycle#Versions_and_their_end-of-life the official table]. In this table, currently supported versions are in '''bold'''. Click on the link of the version you want to download, either provided by the Software Version Checker, or a newer version compared to your current version. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to <code>mediawiki-xxx.tar.gz</code>. Download this file and save it somewhere on your PC.
 
Click on the link of the version you want to download, either provided by the Software Version Checker, or a newer version compared to your current version. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to <code>mediawiki-xxx.tar.gz</code>. Download this file and save it somewhere on your PC.


== Making a backup ==
== Making a backup ==

Revision as of 23:59, 6 May 2021

The MediaWiki project provides an official wiki page which explains the procedure to update a wiki. Unfortunately, their instructions are complex, and the page contains a lot of information that is outdated or irrelevant for our users. To make it easier for our users to update, this documentation page aims to be more accessible and easier to understand. However, this page is not an authoritative source on the subject. If the instructions on this page are unclear at any point, you should always refer back to the official instructions.

Downloading the latest version

To start updating MediaWiki, you will need to download the version you want to update to.

If you arrived at this page after receiving an email from our Software Version Checker. This email might contain a line similar to:

- MediaWiki in <path>. Installed version: <version1>. Latest version: <version2>.

This line tells you where the MediaWiki installation is located, its current version, and the version you need to download.

If you don't have an email from our Software Version Checker, you can find your current MediaWiki version by going to the Special:Version#Installed_software page on your wiki. For example, for this wiki, you can find the current version at Special:Version#Installed_software.

A table of all recent MediaWiki versions can be found on the the official table. In this table, currently supported versions are in bold. Click on the link of the version you want to download, either provided by the Software Version Checker, or a newer version compared to your current version. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to mediawiki-xxx.tar.gz. Download this file and save it somewhere on your PC.

Making a backup

An important step in the update process is to create a backup of your data on the ULYSSIS server, to prevent data loss if something goes wrong. Additionally, this backup will be used to copy files from your old installation to the new installation. Consequently, this step is mandatory.

The easiest way to create a backup is to rename the directory containing your LocalSettings.php configuration file (your wiki location) to a new directory. If you don't know how to access your files on your ULYSSIS account, refer to Accessing your files for easy instructions. For example, if LocalSettings.php is stored in www/wiki, you should rename this directory to www/wiki_backup, or something similar.

If you used Cyberduck to rename the directory, you should refresh it by right clicking the directory and pressing "Refresh".

Installing the new files

Now, you will need to upload the mediawiki-xxx.tar.gz file you downloaded in step 1 to the same path as where your wiki backup directory is located. For example, if your wiki backup directory is located in www/wiki_backup, upload mediawiki-xxx.tar.gz to www/.

After uploading, you can extract the file on the server by using the Cyberduck "Expand Archive" feature. Simply right click the file and click "Expand Archive".

Cyberduck expand.png

This will create a directory named mediawiki-xxx. Rename this directory to the original name of your wiki directory on your ULYSSIS account. For example, if the original name was wiki, rename this directory from mediawiki-xxx to wiki. This can be done using Cyberduck by right clicking the directory and clicking "Rename".

Cyberduck rename.png

Make sure to refresh after renaming by right clicking the directory and pressing "Refresh".

Finally, you need to copy the configuration files and other files or directories you modified from the old directory to the new directory. The easiest way to do this using Cyberduck is by creating a "New Browser". Right click the new directory, and click "New Browser".

Cyberduck new browser.png

Then, you can simply place both windows next to each other, and drag-and-drop files or directories to copy them from the old directory to the new directory. For example, copying LocalSettings.php:

Cyberduck drag and drop.png

Although the exact files you need to copy are different depending on your wiki, here are some suggestions from the official instructions:

  • LocalSettings.php, which contains your old configuration settings.
  • The directory containing the uploaded files to the wiki. Most likely, this is images/, unless you set the value $wgUploadDirectory in LocalSettings.php
  • In case you use a custom logo or favicon, this file also needs to be restored from backup. You can find the locations of these files by checking the $wgLogo and $wgFavicon values in LocalSettings.php.
  • Custom extensions from within the extensions/ directory. Be careful not to overwrite the default extensions that are bundled with the new MediaWiki version.
  • Custom skins from within the skins/ directory. Be careful not to overwrite the default skins that are bundled with the new MediaWiki version.
  • Any modifications made to the old installation files, extensions, or skins. For example, this includes miscellaneous modifications to the configuration of extensions or skins.
  • Any .htaccess file, if present.

Updating extensions

If you use any extensions that are not bundled with MediaWiki by default, you should update them too. As the installation instructions for each extension are different for each extension, this page can't help you with this process. However, most extensions follow the same template as the MediaWiki upgrade itself:

  • Downloading the latest version: make sure to download the correct update for your new MediaWiki version.
  • Making a backup of the extension: you should already have a backup in the directory you created in step 2.
  • Extracting the files: similar to the MediaWiki zip files, you might have to copy the new extension files to a directory in the new extension/ directory.

Finalizing the update

The final step in the update process is to update the database structure of your wiki. The MediaWiki developers were kind enough to create a script, called update.php. This script can be executed using the Cyberduck "Send Command" feature.

Cyberduck send command.png

Enter the following command in the pop-up box:

php <wiki installation location>/maintenance/update.php

For example, if your wiki is located at www/wiki, the command should be as follows:

Cyberduck update.png

After pressing "Send", the command will be executed on the server. If everything went well, you should see a lot of output, ending with something like:

Cyberduck update output.png

Congratulations! You successfully updated MediaWiki. Still, there are two more important steps you must perform:

  • Test your new MediaWiki installation: make sure all basic functionality (viewing, editing pages, file upload) works and all your extensions function properly.
  • Delete the backup installation: for example, if your backup is stored in www/wiki_backup, you can remove it using the command line or through a GUI. A simple GUI explanation can be found on Accessing your files.

However, if you did encounter any errors while executing the script, you could try taking a look at the official instructions. If this does not resolve your problems, feel free to send us an email. We will try to assist you in completing the update.