subscribe: Posts | Comments

Mediawiki updates

Comments Off on Mediawiki updates

When  new WordPress version comes out, updating is amazingly easy.  For me, it has worked flawlessly every time.  Here’s my big thankyou to those word-pressers who spend so much time making sure this happens.

If you run a wiki, you may regret that Mediawiki is not quite so easy, especially if you have done any customization to suit your needs.  Mediawiki is great software, but it does take a little more work than just pressing an ‘update automatically’ button.

Recently, Mediawiki released two new versions in three days, and doing the same job four times (I tend a couple of wikis) made me realize that a simple list of actions was going to be more useful than the collection of notes I’d worked with in the past. This won’t be applicable to everyone, but if you run a mildly-customized mediawiki on your site, I hope it will be useful.

Preparations and deciding approach

Before doing any of this, backup your database file and all files on your wiki.  Your hosting account’s CPanel (Control Panel)  or ePanel should have functions to do this.

Download the latest MediaWiki release from

If you subscribe to the MediaWiki Announcements Digest, the email will contain an explicit link that takes you straight to the right download.  It will be a file named along these lines: mediawiki-1.1n.n.tar.gz

Decide the approach to take, based on the kind of update are you doing:

  1. Single-step within a version, like 1.19.0 to 1.19.1 — start here (see also the note about applying a patch)
  2. Single-step to a new version, like 1.17.5 to 1.18.0 (at the time of writing, 1.17.5 was the last release of 1.17) — start here
  3. A major jump like 1.4 to 1.19.1 — consult the detailed reference page.

Single-step within a version

E.g. 1.19.0 to 1.19.1

Prepare the files

With an update that you can see from the announcement description is simple the aim is to identify and upload only the files that have changed.  Download the compressed files, for example, mediawiki-1.19.0.tar.gz and mediawiki-1.19.1.tar.gz and unpack them into separate folders named mediawiki-1.19.0 and mediawiki-1.19.1.

Compare the folders mediawiki-1.19.0 and mediawiki-1.19.1 using comparison software like Beyond Compare, and delete all files that are identical in both version.  What’s left in the folder mediawiki-1.19.1 will be the changed or new files that you will want to upload to your wiki.  Check first though that none of these files are ones that you have customized for your own wiki.

You can upload with Beyond Compare as well – I find this software very useful and recommend it.

Single-step to a new version

Upload the files

  • Make a temporary directory called gz in the www directory of the site housing your wiki.  You could do this directly in the www directory, but I like to keep it clean and separate until I’m ready to swap directories.
  • Upload the .tar.gz file, e.g. mediawiki-1.16.4.tar.gz to new directory gz.
  • Your cPanel or similar will probably let you expand that in situ.

•     If you have command line access to your server, (via Putty for example) go to that directory with something like

$ cd www/www/gz

(the exact directory path will depend on how your web server is set up), then do this (modifying the version 1.16.4 to be the one you’re updating to):

$ tar xzvf mediawiki-1.16.4.tar.gz

•     If not you may be able to run it like this:

In /gz/ make expand.php containing (e.g.):

system ("tar xzvf mediawiki-1.16.4.tar.gz");

Again you will need to replace the version number 1.16.4 with the one you’re updating to.

Run that e.g.

Now you will have an expanded directory inside /gz/  called something like mediawiki-1.16.4 and you will prepare this before committing your wiki.

Customizing the new version

  • Next, copy your own required wiki folders like ../wiki/extensions and past uploaded images (../wiki/images) to the corresponding location in the temporary wiki directory (e.g.) ../gz/mediawiki-1.16.4/extensions etc.  If possible, use the File Manager function in your CP (Control Panel) for this, it’s way faster than FTP or other desktop-to-online software like Beyond Compare.  Of course if you have command line access, that will be fast as well.
  • And rename or delete the config directory.

For the remaining low-volume individual copies, I find Beyond Compare very convenient.  It lets me compare items in the old and new versions and repeat my customizations in the new version without keying errors.

Skin customization

You probably have your own logo image at the top left of the wiki.

  • If the special logo is defined in LocalSettings.php as e.g.
$wgLogo = "{$wgScriptPath}/mywiki-logo.png";

then copy ../wiki/mywiki-logo.png  to
../gz/mediawiki-1.1n.n/ mywiki-logo.png

otherwise copy (e.g.)
../wiki/skins/common/images/wiki.png  to

  • If you use a special background image, copy that to the new directory (e.g.)../wiki/skins/monobook/headbg.jpg  to../gz/mediawiki-1.1n.n/skins/monobook/headbg.jpg
  • If you use a different-colored background, then in .. /wiki/skins/monobook/main.css   find
body {
       font: x-small sans-serif;
       background: #f9f9f9 url(headbg.jpg) 0 0 no-repeat;

Change f9f9f9 to match desired colour at foot of headbg.jpg

Use comparison software like Beyond Compare, check that all other changes are related to the new version, not to changes you have made to personalize your wiki.

  • Copy ../wiki/LocalSettings.php  to  ../gz/mediawiki-1.1n.n/LocalSettings.php
  • Check if new ../gz/mediawiki-1.1n.n/MonoBook.php has any differences from existing one other than Adsense, Analytics and StatCounter code if you use these in the wiki.  If so, add code for those three items.

If not, copy modified ../wiki/MonoBook.php  to  ../gz/mediawiki-1.1n.n/MonoBook.php

  • To keep control of appearance, I remove all skin options other than Monobok.  To do this, I change all skin php files in /skins except monobook.php to xxxxxxx.php_ so that they do not appear in user preferences.  You could just delete them.

Rename folders to start change to new version

  • Rename e.g. ../wiki/  to  ../ wiki-1.16.2/ where the number is that of the old version.  Your old directory will therefore be preserved in case of problems.  Your wiki will briefly be unavailable at this point, but the next operation will bring it back.
  • Move e.g.  ../gz/mediawiki-1.16.4/ to ../wiki/ Again use the Control Panel, and it will be very fast.

Completing the update

Depending on your hosting plan, you may need to ask the ISP support service to run the update process.

  • You can send a message along these lines
I want to update my mediawiki on  Will you help as follows please:
update.php is in
will you run this from the command line for me please? :-
php update.php
  • But if you have command line access to the server, you probably don’t need me to tell you, but all you need to do is something like
$ cd www/www/wiki/maintenance/
$ php update.php

Now check to see that the update has taken effect modifying one of these URLs as needed for your wiki:  or

Again, check the wiki’s operation, this time test viewing and editing articles, and uploading a file.



P.S.  –  Here’s the final option – one I haven’t tried myself:

Applying a patch

There is another way of minimizing the effort of an update.  It works for only a single-step update – from one release to the next.  I don’t use it, because its operation is automatic and therefore out of my control so I can’t be sure it won’t affect one of my customizations.  It is quick though and involves the least effort.

I found the simple instructions here, but I’ve amended them to make them compatible with my notes above.  The original assumes you have full access to the Linux command line, and as you’ll likely have to use putty or ask your ISP support people to run it for you.

Here we are upgrading 1.19.0 to 1.19.1 – go to and pick your patch:

Unzip the patch and upload it to your wiki’s web directory:


Apply the patch:

cd /home/mysite/www/www/wiki/
patch -i mediawiki-1.19.1.patch -p 1
Remove the patch file:
rm -rf mediawiki-1.19.1.patch

verify the version

Comments are closed.