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 two 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.
This is for a routine update of version, not a major jump like, for example, 1.4 to 1.16 when you should consult the detailed reference page.
Before doing any of this, backup your database file and all files on your wiki. Chances are your CP (Control Panel) will have functions to do this.
Get new the new version of mediawiki and upload it
- Download the latest release from http://dumps.wikimedia.org/mediawiki/ 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 - 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.
- If you have command line access to your server, 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.):
<pre>
<?php
system ("tar xzvf mediawiki-1.16.4.tar.gz");
?>
</pre>
Again you will need to replace the version number 1.16.4 with the one you’re updating to.
Run that e.g. http://www.yourdomain.com/gz/expand.php
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
../gz/mediawiki-1.1n.n/skins/common/images/wiki.png
- 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
or just copy main.css from /wiki/ to /mediawiki-1.1n.n/ using software like Beyond Compare to check that nothing else has changed.
- 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.
Check that wiki still works. The database has not been updated yet, but it will be using the latest code. If it doesn’t you can reverse the last two operations while you investigate.
Run 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
Hi, I want to update my mediawiki on mysite.com. Will you help as follows please: update.php is in /home/mysite/www/www/wiki/maintenance/ will you run this from the command line for me please? :- php update.php Thanks.
- 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:
http://www.mysite.com/wiki/index.php?title=Special:Version or
http://www.mysite.com/wiki/Special:Version
Again, check the wiki’s operation, this time test viewing and editing articles, and uploading a file.
Roy














