Menu

Post navigation

I use MediaWiki as a personal note-taking, documentation and code snippet storage system. This was started as an experiment, but a wiki proved to be a decent solution for the above tasks. This is a small checklist, mainly for my own reference, to follow when upgrading MediaWiki.

Dump the wiki database

This is done so to be sure that our wiki data is safe in case anything goes wrong (very unlikely):

mysqldump -u mymysqluser -p --opt --databases mywikidb > mywikidb.sql

Or if your database is too big, you can pipe it to gzip before dumping to file:

How to restore the database

Just in case anything goes wrong with the upgrade procedure and you need to restore the backed up database, all you have to do is:

mysql -u mymysqluser -p mywikidb < mywikidb.sql

Backup the wiki files

Take a copy of the wiki files and directories:

cp -a wikidir wikidir.BAK

Delete old wiki files

Delete the old files and directories except:

the extensions/ directory (if there are any extensions installed)

the images/ directory (if there are uploaded images)

the .htaccess file

the AdminSettings.php file

the LocalSettings.php file

Upload the new wiki files

Move the new wiki files to the the wiki directory and set proper permissions:

chmod -R u=rwX,g=-,o=rX wikidir/

Note that you might need to further protect AdminSettings.php, LocalSettings.php and any other file that contains sensitive information, by restricting access to it with proper rules inside the .htaccess file. For example:

<files ~ "^.+Settings\.php">
Order allow,deny
Deny from all
</files>

Upgrade the wiki database tables

Change to the maintenance/ directory and run:

php update.php

Also, it is recommended to refresh the links between the various articles inside the wiki. To do this run the refreshLinks.php script:

php refreshLinks.php

Delete the config/ directory

The config/ directory is not needed so you might want to completely delete it or restrict access to it.

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

3 responses on “MediaWiki Upgrade Procedure”

The above way of upgrading assumes that the hosting service provides shell access (most probably through SSH) to your account and, furthermore, access to the php interpreter from the command line. It seems that this is not possible in your case.

There are alternative ways of upgrading, which cover your situation, but please look for them in the official Mediawiki documentation.

I am also hosting the mediawiki files on godaddy. I am trying to upgrade from 1.5 to 1.7 and am having no luck. I backed up my database, and all the wikimedia files. Then I replace all the old files with the new ones using an ftp program. The last step says to run the update.php using a command line. I am not sure what this means. Opening the command prompt on my windows machine will do nothing obviosly since the program is hosted not on my computer, but on godaddy. I have tried entering RAW commands using my FTP program to no avail. so, How do I run the update.php file located on the server? Thanks!

A different provider, but I have the same challenge. Why is it not possible to run this update script from the godfather-role?

About

G-Loaded Journal is a technical blog that publishes news, guides and tutorials about GNU/Linux and other Free Open-Source Software. Our mission is to share our experience and knowledge about system administration, automation and programming.