Difference between revisions of "MediaWiki/Upgrade/REL1 25 to REL1 26"

From Freephile Wiki
Jump to navigation Jump to search
(update)
Line 1: Line 1:
 
=== Overview ===
 
=== Overview ===
  
I just upgraded my wiki site, and thought I would write down the steps for further reference.  Even though the README, UPGRADE and online help are very detailed, I find it helpful to note my personal preferences, observations, and clarifications where I might not understand the instructions.
+
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 [[mw:Manual:Upgrading#Using_Git|official docs]] are the best resource. If you need professional help with MediaWiki, then contact [[User:Freephile|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 decided to join that practice and run off SVN trunk.  So, I simply did a <code>svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3</code> to get the code.
+
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 <code>composer update --no-dev && git fetch</code> to prepare for an upgrade.
 
 
I performed a diff of the entire tree v. my installed copy using the venerable KDiff3 to get an idea of the magnitude of the code changes; to learn by reading some code changes and get a feel for the 'current best practices'.  It also helped me to see what old stuff was deprecated, or that I had lying around as cruft on my filesystem.  Since it had been a long time since my last upgrade, there was a large delta.  I didn't want to or have time to look at all the code improvements so I moved on to the next step.
 
  
 
=== Consult the release notes ===
 
=== Consult the release notes ===
Line 16: Line 14:
 
=== Backup first ===
 
=== Backup first ===
  
I copied my filesystem as a backup.
+
I copied my filesystem as a backup and testing ground.
  
I copied my database as a backup.  I noticed that phpMyAdmin failed silently to create a backup because it exhausted the PHP memory limit.  When I say 'failed silently' I mean that it saved the export as a compressed file on my system without complaining, but the contents of that file were the plain-text error message from PHP.  I could have increased the script memory limit, but instead I found that an uncompressed version of the export would work. I also could have used mysqldump or the Mysql Administrator client.
+
For the database, I have a backup script that in addition to timed backups, will create a spot backup on demand: <code>~/bin/backup.db.sh mediawiki</code>
  
 
=== Perform the file upgrade ===
 
=== Perform the file upgrade ===
  
Having downloaded the desired new version of the software, either as a package
+
The mechanism for loading extensions has changed, so the old 'requires' can be replaced by 'wfLoadExtension' function <code>require_once\(  *"\$IP/extensions/.*/([^/]*)" * \); wfLoadExtension( '\1' );</code>
from SourceForge, or via an export from Subversion, decompress the files as
 
needed, and replace the existing MediaWiki files with the new.
 
  
You should preserve:
+
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 <code>git checkout -b REL1_26 origin/REL1_26</code> and then do the database upgrade.
 +
 
 +
You must preserve:
  
 
* The LocalSettings.php file
 
* The LocalSettings.php file
* The AdminSettings.php file, where it exists
+
* DatabaseSettings file, where it exists
 
* The extensions directory
 
* The extensions directory
 
* The images directory
 
* The images directory
  
If using an alternative uploads directory, preserve this; and if using custom
+
If using an alternative uploads directory, preserve this; and if using custom skins, preserve these too. The core code is now updated.
skins, preserve these too. The core code is now updated.
 
 
 
I did all of those because I do have an 'accessible' skin.  The easy way to do the filesystem upgrade is with the rsync command.  Besides the filesystem update, you also need to create a AdminSettings.php file with credentials to access your database.
 
 
 
:<code>user@host:/path/to/docroot$ rsync -vrc --delete --stats --progress --exclude images/ --exclude extensions/ --exclude LocalSettings.php --exclude skins/disabled/ mediawiki-1.6.1/ wiki</code>
 
 
 
  
 
=== Perform the database upgrade ===
 
=== Perform the database upgrade ===
Line 66: Line 58:
  
 
=== Change the wiki pointer ===
 
=== Change the wiki pointer ===
In order to quickly upgrade, revert or take the site offline, I simply use a symbolic link and point that to the folder that I wantIn order to complete the upgrade, all that was left was to change the target of my wiki symbolic link from phase3_1_7_1 to phase3_1_11
+
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 <code>$IP</code> is not defined correctly
  
 
=== Test ===
 
=== Test ===

Revision as of 16:54, 5 January 2016

Overview[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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.