Documentation

Difference between revisions of "Updating MediaWiki"

Line 19: Line 19:
 
* If the most recent LTS branch is older than your current branch, you should choose the newest supported branch (green).
 
* If the most recent LTS branch is older than your current branch, you should choose the newest supported branch (green).
  
Now, click on the link of the branch you want to download. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to <code>mediawiki-1.xx.yy.tar.gz</code>. Download this file and save it somewhere on your computer.
+
Now, click on the link of the branch you want to download. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to <code>mediawiki-1.xx.yy.tar.gz</code>. Download this archive and save it somewhere on your computer.
  
 
== Renaming the old installation ==
 
== Renaming the old installation ==
Line 29: Line 29:
 
Now, you will need to upload the <code>mediawiki-1.xx.yy.tar.gz</code> file you downloaded in step 1 next to the old installation directory. For example, if your old installation directory is located in <code>www/wiki_old</code>, upload <code>mediawiki-1.xx.yy.tar.gz</code> to <code>www/</code>.
 
Now, you will need to upload the <code>mediawiki-1.xx.yy.tar.gz</code> file you downloaded in step 1 next to the old installation directory. For example, if your old installation directory is located in <code>www/wiki_old</code>, upload <code>mediawiki-1.xx.yy.tar.gz</code> to <code>www/</code>.
  
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".
+
After uploading, you can extract the archive file on the server by using the Cyberduck "Expand Archive" feature. Simply right click the archive and click "Expand Archive".
  
 
[[File:Cyberduck expand.png|thumb|center]]
 
[[File:Cyberduck expand.png|thumb|center]]
Line 47: Line 47:
 
Although the exact files you need to copy are different depending on your wiki, here are some suggestions from the [https://www.mediawiki.org/wiki/Manual:Upgrading#Other_files official instructions]:
 
Although the exact files you need to copy are different depending on your wiki, here are some suggestions from the [https://www.mediawiki.org/wiki/Manual:Upgrading#Other_files official instructions]:
 
* <code>LocalSettings.php</code>, which contains your old configuration settings.
 
* <code>LocalSettings.php</code>, which contains your old configuration settings.
* The directory containing the uploaded files to the wiki. Most likely, this is <code>images/</code>, unless you set the value <code>$wgUploadDirectory</code> in <code>LocalSettings.php</code>
+
* The <code>images/</code> directory, containing the uploaded files to the wiki.
 
* Custom extensions from within the <code>extensions/</code> directory. Be careful not to overwrite the default extensions that are bundled with the new MediaWiki version.
 
* Custom extensions from within the <code>extensions/</code> directory. Be careful not to overwrite the default extensions that are bundled with the new MediaWiki version.
 
* Custom skins from within the <code>skins/</code> directory. Be careful not to overwrite the default skins that are bundled with the new MediaWiki version.
 
* Custom skins from within the <code>skins/</code> directory. Be careful not to overwrite the default skins that are bundled with the new MediaWiki version.
Line 53: Line 53:
  
 
== Updating extensions ==
 
== Updating extensions ==
If you use any extensions that are not bundled with MediaWiki by default, you should update them too. A list of bundled extensions can be found at https://www.mediawiki.org/wiki/Bundled_extensions_and_skins. For example, you might have the ULYSSIS extensions [[Securing MediaWiki using Centrale KU Leuven Login|MediaWikiShibboleth]] or [https://github.com/ULYSSIS-KUL/CompressUploads CompressUploads] installed. As with MediaWiki itself, you can find the versions of your installed extensions on the <code>Special:Version</code> page, under "Installed extensions". Extensions will often link to a website where you can download the latest versions. For example, for this wiki, you can find the installed extensions at [[Special:Version]]. At the time of writing, it looks like this:  
+
If you use any extensions that are not bundled with MediaWiki by default, you should update them too. A list of bundled extensions can be found at https://www.mediawiki.org/wiki/Bundled_extensions_and_skins, these extensions will be updated automatically. However, for example, you might have the ULYSSIS extensions [[Securing MediaWiki using Centrale KU Leuven Login|MediaWikiShibboleth]] or [https://github.com/ULYSSIS-KUL/CompressUploads CompressUploads] installed. As with MediaWiki itself, you can find the versions of your installed extensions on the <code>Special:Version</code> page, under "Installed extensions". Extensions will often link to a website where you can download the latest versions. For example, for this wiki, you can find the installed extensions at [[Special:Version]]. At the time of writing, it looks like this:  
  
 
[[File:Installed extensions.png|center|frame]]
 
[[File:Installed extensions.png|center|frame]]
  
Because 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:
+
Because the update instructions are different for each extension, you will have to refer to the update instructions of the extension you want to update. 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.
 
* 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.
 
* 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 <code>extension/</code> directory.
+
* Extracting the archive files: similar to the MediaWiki tar.gz archive files, you might have to copy the new extension files to a directory in the new <code>extension/</code> directory.
  
 
== 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>. 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. Your MediaWiki installation contains a script, called <code>update.php</code>, to perform the necessary database upgrades. This script can be executed using the Cyberduck "Send Command" feature.
  
 
[[File:Cyberduck send command.png|thumb|center]]
 
[[File:Cyberduck send command.png|thumb|center]]
Line 78: Line 78:
  
 
[[File:Cyberduck update output.png|center|750px]]
 
[[File:Cyberduck update output.png|center|750px]]
 +
 +
However, if you did encounter any errors while executing the script, you could try taking a look at the [https://www.mediawiki.org/wiki/Manual:Upgrading#Command_line_2 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.
  
 
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:
 
* Test your new MediaWiki installation: make sure all basic functionality (viewing, editing pages, file upload) works and all your extensions function properly.
 
* Test your new MediaWiki installation: make sure all basic functionality (viewing, editing pages, file upload) works and all your extensions function properly.
* Delete the old installation: for example, if this is stored in <code>www/wiki_old</code>, you can remove it using the command line or through a GUI. A simple GUI explanation can be found on [[Accessing_your_files#Creating_and_Deleting_files_and_folders|Accessing your files]].
+
* Delete the old installation: you should remove the previously created <code>www/wiki_old</code> directory, using the command line or through a GUI. A simple GUI explanation can be found on [[Accessing_your_files#Creating_and_Deleting_files_and_folders|Accessing your files]].
 
 
However, if you did encounter any errors while executing the script, you could try taking a look at the [https://www.mediawiki.org/wiki/Manual:Upgrading#Command_line_2 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.
 

Revision as of 14:56, 8 August 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.

In this guide, we assume you are familiar with the files on your ULYSSIS account. If you don't know how to access these files, please read Accessing your files first.


Downloading the right version

To start updating MediaWiki, you will need to download the archive file of the version you want to update to. If you arrived at this page after receiving an email from our Software Version Checker, follow the instructions in the next paragraph. Otherwise, you can skip the next paragraph.

The email you received 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 page on your wiki (simply paste this in the search box) and looking for the "MediaWiki" version under "Installed software". For example, for this wiki, you can find the current version at Special:Version. At the time of writing, it looks like this:

Installed software.png

A table of all recent MediaWiki versions can be found on the the official table. Currently supported versions are indicated by a green or yellow color in the first column. To determine which version you want to download, follow these steps:

  • If the branch of your version (the first two numbers, like 1.xx) is currently supported (green or yellow), you should choose the latest version for this branch. For example, for version 1.35.3, the branch is 1.35.
  • If this branch is not supported anymore, you should choose the most recent LTS branch. This is indicated by (LTS) in the second column. Make sure this LTS branch is not older than your current branch!
  • If the most recent LTS branch is older than your current branch, you should choose the newest supported branch (green).

Now, click on the link of the branch you want to download. This will redirect you to a page with information about this version. The first paragraph on this page contains a link to mediawiki-1.xx.yy.tar.gz. Download this archive and save it somewhere on your computer.

Renaming the old installation

An important step in the update process is to rename the old installation directory. This way, you can simply copy your data from the old installation directory to the new installation directory during the update. Additionally, you can easily restore your old wiki if something goes wrong.

The easiest way to do this, is to rename your wiki location (the directory containing your LocalSettings.php configuration file) 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 the wiki folder to wiki_old.

Installing the new files

Now, you will need to upload the mediawiki-1.xx.yy.tar.gz file you downloaded in step 1 next to the old installation directory. For example, if your old installation directory is located in www/wiki_old, upload mediawiki-1.xx.yy.tar.gz to www/.

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

Cyberduck expand.png

This will create a directory named mediawiki-1.xx.yy. 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-1.xx.yy to wiki. This can be done using Cyberduck by right clicking the directory and clicking "Rename".

Cyberduck rename.png

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 images/ directory, containing the uploaded files to the wiki.
  • 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 .htaccess file, if present. Make sure you can view hidden files; to enable this for Cyberduck, you can look at Accessing your files.

Updating extensions

If you use any extensions that are not bundled with MediaWiki by default, you should update them too. A list of bundled extensions can be found at https://www.mediawiki.org/wiki/Bundled_extensions_and_skins, these extensions will be updated automatically. However, for example, you might have the ULYSSIS extensions MediaWikiShibboleth or CompressUploads installed. As with MediaWiki itself, you can find the versions of your installed extensions on the Special:Version page, under "Installed extensions". Extensions will often link to a website where you can download the latest versions. For example, for this wiki, you can find the installed extensions at Special:Version. At the time of writing, it looks like this:

Installed extensions.png

Because the update instructions are different for each extension, you will have to refer to the update instructions of the extension you want to update. 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 archive files: similar to the MediaWiki tar.gz archive 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. Your MediaWiki installation contains a script, called update.php, to perform the necessary database upgrades. 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

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.

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 old installation: you should remove the previously created www/wiki_old directory, using the command line or through a GUI. A simple GUI explanation can be found on Accessing your files.