Updating MediaWiki: Difference between revisions

From ULYSSIS documentation
(D)
Line 51: Line 51:


== Finalizing the update ==
== 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 <code>update.php</code>. 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.
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><username>/www/wiki</code>, execute:
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:
cd maintenance
This directory contains the <code>update.php</code> file. To run this script, execute:
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, ended with:
Done in x s.

Revision as of 21:08, 25 April 2021

The MediaWiki project provides an official wiki page which explains the procedure to update a wiki. Unfortunately, their instructions are very dense, 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.

With this out of the way, you can start the MediaWiki update process.

Downloading the latest version

Most likely, 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 latest version. Of course, to update MediaWiki to this latest version, you will need to download the update. The MediaWiki downloads can be found here. Make sure to download the zip file for the latest version from the email 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. If you don't know how to access your files on your ULYSSIS account, refer to Accessing your files for easy instructions. The backup step consists of roughly two parts:

  • Creating a backup of your wiki database. If you use MySQL or PostgreSQL, you can follow the instructions on Making Backups#A backup of your databases. If you use SQLite, please refer to the official instructions. If you are not sure about your database type or the name of your wiki database, you can search the LocalSettings.php configuration file for the following lines:
## Database settings
$wgDBtype           = "<db_type>";
$wgDBserver         = "<db_server>";
$wgDBname           = "<db_name>";
$wgDBuser           = "<user>";
$wgDBpassword       = "<password>";
  • Creating a backup of your wiki files. The easiest way to do this is to rename the directory containing your LocalSettings.php configuration file (your wiki location) to a new directory. For example, if LocalSettings.php is stored in <username>/www/wiki, you should rename this directory to <username>/www/wiki_backup, or something similar.

Extracting the new files

Now, you will need to extract the zip file you downloaded in step 1. This should result in a directory which looks something like:

mediawiki-xxx/
├── cache/
├── docs/
├── ...
├── api.php
├── autoload.php
└── ...

Rename this directory to the original name of your wiki directory on your ULYSSIS account. For example, if your wiki was located at <username>/www/wiki, rename this directory from mediawiki-xxx to wiki.

Next, you should upload this directory to your ULYSSIS account, to the original location of your wiki. If you followed step 2 correctly, the old files should be moved to a backup directory. As a result, after uploading, your ULYSSIS acocunt should contain the new files in something like <username>/www/wiki, and the old files in <username>/www/wiki_backup. Please refer to Accessing your files if you don't know how to upload files. Because MediaWiki contains a lot of (small) files, this might take a long time, up to 30 minutes.

Finally, you need to copy the configuration files and other files or directories you modified from the old directory to the new directory. Although only you know exactly which files these are, here are some suggestions from the official instructions:

  • LocalSettings.php, which contains your old configuration settings.
  • The images/ directory, which contains all the uploaded files to the wiki, unless you have chosen a different upload directory. In that case, you should copy the different upload directory.
  • In case you use a custom logo, this file also needs to be restored from backup. This logo is stored in resources/assets/ or images/, depending on what you chose to use.
  • 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. 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.

After connecting to your account using SSH, navigate to the directory containing your new wiki installation. For example, if your wiki is located at <username>/www/wiki, execute:

cd ~/www/wiki

This directory should contain all your wiki files, such as LocalSettings.php. Now, navigate to the maintenance/ directory:

cd maintenance

This directory contains the update.php file. To run this script, execute:

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, ended with:

Done in x s.