Extension:PurpleWiki2MediaWiki

Migration of wikis from PurpleWiki to MediaWiki
Author: Tejas Parikh

Date: 05/08/2009

History:

v1.0: Initial Version

This guide, just like the software, is provided as is and without warranty.

Introduction
This document outlines the steps for migrating PurpleWiki (version 0.96 only) instances to MediaWiki using the PHP/Perl scripts provided.

Assumptions and Tools Required

 * Perl and PHP (obviously).
 * Admin permissions to the MediaWiki instance. Create a user account that migration script can use to migrate pages (more details below).
 * Access to PurpleWiki's user database(folder with user files) and wiki pages database(folder with all the files).

Outline
The migration script allows extraction of all pages and user accounts from PurpleWiki instance and migrate/import it to a MediaWiki installation. MediaWiki install should be up and running, be publicly available before migration can begin. This is due to the fact that the pages are migrated over using Web Service which works over HTTP protocols.

Step 1: Extraction of PurpleWiki User Data Content

 * Lock the PurpleWiki installation either by making the wiki unavailable or read only so that no new data can be added while data is being migrated.
 * Copy the user folders (0 thru 9) from PurpleWiki's instance to a directory on the server where you will run the migration script.
 * Copy the data folders (A thru Z and 0 thru 9) from PurpleWiki's instance to a directory on the server where you will run the migration script.

Step 2: Setup MediaWiki installtion

 * Setup latest version of MediaWiki on the server where you want to migrate the data.
 * DO NOT use clean url or any other techniques until migration is done. Leave the installation as simple as possible.
 * DO NOT add captcha or any other spam prevention techniques. Migration script will NOT work in these circumstances.
 * It is HIGHLY RECOMMENDED to leave MediaWiki to its default settings until the migration is done.

Step 3: Extracting PurpleWiki User Names and Password Into Plain Text File

 * Before the migration can start, all usernames and passwords have to written to a plain text file that the migration script has access to.
 * To do this, configure the Perl script ParseUserInfo.pl. Edit the file in a text editor, setting the following variables
 * $userBaseDir this is the path to the user folder (make sure there is no / at the end of the path). e.g. /home/migration/user
 * $outputDir this is the folder where the script can write the password file. You also specify the name of the password file here. e.g. /tmp/PurpleWiki-User-Info.data

NOTE: Only user accounts with passwords will be migrated.

To run the perl script execute the following command: perl ParseUserInfo.pl

Step 4: Configuring the Config.php file

 * ini_set('memory_limit', '64M') If PHP's memory limit is very low, migration may fail. Recommended setting is 64-128 MB
 * $wikidbPath Path to wikidb directory
 * $mwUserFilePath Path to PurpleWiki user info file (generated using the perl script)
 * $wikiroot Path to the MediaWiki Install. Make sure there is no "/" at the end of the URL
 * $mwUser MediaWiki Migration UserName
 * $mwPasswd MediaWiki Migration User's password
 * $logFile Log file (whole path with file name e.g. /tmp/migration.log)
 * $transclusionLogFileFile Transclusion log file
 * $directory Range of directory to migrate. $directory = range("A","Z"); to migrate all the pages
 * $migrateData flag to migrate data from PurpleWiki to MediaWiki. Set to true by default(Recommended setting).
 * $migrateUsers flag to migrate user accounts from PurpleWiki to MediaWiki. Set to true by default(Recommended setting).
 * $oldHostName PurpleWiki's server hostname if the server's hostname is http://www.purplewiki.com/wiki/cgi-bin/wiki.pl? then enter only www.purplewiki.com/wiki
 * $newHostName MediaWiki installation's hostname e.g. http://www.mediawiki.com/wiki/ . Do not include index.php in the url.

Step 5: Running the migration script
To start the migration, run the PHP script PurpleWiki2MediaWiki.php on the command line using the following command. php PurpleWiki2MediaWiki.php

If script is configured properly, script will notify you that its starting migration. Depending on the size of the PurpleWiki's data and the network traffic, it can take anywhere from few minutes to couple hours to finish the migration.

Make sure to check the log files to see if everything went ok.

Step 6: Fixing content
Though testing has been done and errors have been caught and fixed, there may still be errors in the migrated pages. It could be that the syntax of a PurpleWiki page was nested in such a way that MediaWiki does not handle or the PurpleWiki pages were wrong in some way.

If you do find a bug in the migration or the code itself, please contact me or add it to the discussion page and I will try to fix it ASAP.