How to upgrade mediawiki

From Mass Pirate Wiki
Jump to navigationJump to search

Background

Our wiki installation is cloned from mediawiki's git repository. Mediawiki has branches for each release; we have branches that track mediawiki branches.

In general, the Masspirates mediawiki is the standard mediawiki distribution, plus a couple of commits (for changes to LocalSettings.php and such).

For example:

 $ git status
 On branch mapp-1.28
 Your branch is ahead of 'origin/REL1_28' by 2 commits.
   (use "git push" to publish your local commits)
 $ git branch
 * mapp-1.28
   master

Above, mapp-1.28 is based on mediawiki's REL1_28 branch, and there are a few changes on top. Upgrading follows one of two procedures:

  1. Pulling in changes from the same branch. In this case, just rebase
  2. Switching to a new branch. Here, we want to make a new (local) branch off the new upstream release, and cherry pick

That's the overview. I'll go into more detail below.

The Upgrade Process

With that said, the upgrade involves five steps.

  1. Backup the database
  2. upgrade code
  3. update composer's dependencies
  4. run maintenance/update.php
  5. resolve any changes to configuration variables
  6. update skins

We'll go through these steps one at a time

Database Backup

 mysqldump --verbose -uUSER -pPASSWD --complete-insert=1 DBNAME | gzip -9 > masspira_mdw1.$(date +%F).sql.gz
 mv *.sql.gz backup

Update Code

Rebasing from the same branch

 git status  # should be no outstanding changes
 git remote update
 git rebase origin/REL1_28

Above, substitute "origin/REL1_28" with the actual upstream branch.

Having done this,

 git log --oneline origin/REL1_28..HEAD

lists the local changes we've made.

Switching to a new Release branch

The general gist

  1. identify changes you've made on the current branch
  2. create a local branch, to mirror one of the mediawiki release branch
  3. cherry pick local changes made on the old branch.

Update composer dependencies

 $ ~/bin/composer.phar self-update
 $ ~/bin/composer.phar update

Note: if composer is too old, it may be necessary to remove and reinstall it.

Running Maintainance Scripts

 $ php maintenance/update.php

Resolving Changes to Configuration Variables

For this step, look at the "UPGRADE" and "RELEASE-NOTES" files in mediawiki's root directory. It's a good idea to look through these files anyway, to see what changes are in the new release.

Update Skins

We use the Monobook skin, which was git cloned from a separate repository than the main mediawiki distribution. It's a submodule that has to be upgraded separately.

 cd skins/MonoBook
 git fetch origin
 git rebase origin/master

Then, commit the submodule changes

 cd ..
 git add MonoBook
 git commit