Open main menu

Overview

Last updated in 2008, it was time to revisit this page and make some new notes. Even though the README, UPGRADE and online help are very detailed, I find it helpful to note my personal preferences, observations, and clarifications. Still, for the do-it-yourself types, the official docs are the best resource. If you need professional help with MediaWiki, then contact Greg Rundlett

The process obviously started with downloading the source from the web. However, since the wikipedia project uses the continuous integration method of development (meaning they always run their own latest code), I follow the same practice and run off either the latest release branch or master from the git repository. So, I simply did a composer update --no-dev && git fetch to prepare for an upgrade.

Consult the release notes

Before doing anything, stop and consult the release notes supplied with the new version of the software. This detail bug fixes, new features and functionality, and any particular points that may need to be noted during the upgrade procedure. There was a lot here, although nothing that impacted the function of my installation.

Backup first

I copied my filesystem as a backup and testing ground.

For the database, I have a backup script that in addition to timed backups, will create a spot backup on demand: ~/bin/backup.db.sh mediawiki

Perform the file upgrade

The mechanism for loading extensions has changed, so the old 'requires' can be replaced by 'wfLoadExtension' function require_once\( *"\$IP/extensions/.*/([^/]*)" * \); wfLoadExtension( '\1' );

With the software downloaded (git fetch), and a check to see if you've modified anything (git status), you can simply switch the branch you're on git checkout -b REL1_26 origin/REL1_26 and then do the database upgrade.

You must preserve:

  • The LocalSettings.php file
  • DatabaseSettings file, where it exists
  • The extensions directory
  • The images directory

If using an alternative uploads directory, preserve this; and if using custom skins, preserve these too. The core code is now updated.

Perform the database upgrade

You will need an AdminSettings.php file set up in the correct format; see AdminSettings.sample in the wiki root for more information and examples.

From the command line, browse to the maintenance directory and run the update.php script to check and update the schema. This will insert missing tables, update existing tables, and move data around as needed. In most cases, this is successful and nothing further needs to be done.

cd wiki/maintenance/
ls
php -q ./update.php

Check configuration settings

The names of configuration variables, and their default values and purposes, can change between release branches, e.g. $wgDisableUploads in 1.4 is replaced with $wgEnableUploads in later versions. When upgrading, consult the release notes to check for configuration changes which would alter the expected behaviour of MediaWiki.

Change the wiki pointer

In order to quickly upgrade, revert or take the site offline, you can simply use a symbolic link and point that to the correct target folder. However, note that this can present problems for your extensions when $IP is not defined correctly

Test

It makes sense to test your wiki immediately following any kind of maintenance procedure, and especially after upgrading; check that page views and edits work normally and that special pages continue to function, etc. and correct errors and quirks which reveal themselves.

  1. User:Freephile/Books/Organic_Gardening to test Collections
  2. Tooltips to test Semantic MediaWiki info parser function
  3. Terminology to test the Lingo extension
  4. Visual editor
  5. Svg for the SVG-Edit extension
  6. Cloning for the PDF Handler extension (show pdf file as thumbnail)
  7. Categories for the Wiki Category Tag Cloud extension
  8. Special:ReplaceText for the Replace Text extension

Extension and Skin Upgrades

Your MediaWiki site will contain many extensions to provide extra functionality. You also have one or more skins installed. Those need to be upgraded independently since they are not distributed with the core (although many are bundled if you download a tarball). The Special:Version page will list the ones in use, so go through the list one at a time and check for upgrades.

For those extensions available in git you can fetch the latest updates to the code with something like

release=REL1_26
# work within the extensions directory so as not to conflict with the main composer.json
cd extensions
base=`pwd`; 
for ext in `find . -type d -name .git | sed 's/.git//' `; do 
  cd $ext; 
  echo "fetching $ext"; 
  git fetch; 
  # checkout the new release branch you want
  git checkout $release;
  # and update dependencies if project uses composer
  if [ -f "./composer.json" ]; then
    composer update;
  fi
  cd $base; 
done

Also, if you don't even know whether there are submodules in use, you can search for those by looking for .gitmodules or .git files find . -type f -name .git And if you want to know which extensions may be using composer, you can check find . -maxdepth 2 -name composer.json |xargs grep -l '"require":'

Preferences

Oftentimes, you will need to test and check Special:Preferences in combination with core, skins, extensions and Gadgets upgrades.

Debug

When things don't quite work as expected, you're left to figure out why. There are several debugging options that can assist you.