Updating MediaWiki: Difference between revisions

From ULYSSIS documentation
Line 58: Line 58:
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 <code>update.php</code>. This script can be executed using the Cyberduck "Send Command" feature.
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 <code>update.php</code>. This script can be executed using the Cyberduck "Send Command" feature.


[[File:Cyberduck send command.png|thumb|center]]


Enter the following command in the pop-up box:


Unfortunately, this script must be executed using the command line. If you are not familiar with the command line or SSH, please read [[Accessing shell servers over SSH]] first.
php <wiki installation location>/maintenance/update.php


After connecting to your account using SSH, navigate to the directory containing your new wiki installation. For example, if your wiki is located at <code>www/wiki</code>, execute:
For example, if your wiki is located at <code>www/wiki</code>, the command should be as follows:
cd ~/www/wiki
 
This directory should contain all your wiki files, such as <code>LocalSettings.php</code>. Now, navigate to the <code>maintenance/</code> directory:
[[File:Cyberduck update.png|center|750px]]
cd maintenance
 
This directory contains the <code>update.php</code> file. To run this script, execute:
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:
php update.php
 
The script will first display a 5 second countdown to execution, just in case you want to abort. After the countdown, you should not interrupt the execution of the script. If everything went well, you should see a lot of text, ending with:
[[File:Cyberduck update output.png|center|750px]]
Done in x s.


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

Revision as of 23:44, 1 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. A table of all recent MediaWiki versions can be found on the the official table. In this table, currently supported versions are in bold.

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 simply choose any supported (bold) version from the table.

Click on the link of the newer 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.