Manual:TikiWiki Conversion

These steps were originally used to convert pages from a version 1.9.3.1 TikiWiki with both wiki syntax and HTML to a version 1.10.4 Mediawiki. In 2019 the code was adapted to the export of a version 12.6 TikiWiki. The script takes a tar file from a TikiWiki export and returns a MediaWiki XML file. During this adaption the original code, which can still be found at the bottom of this page, was ported to a Git-Repository hosted on GitHub, translated to Python 3 and altered to work with the current application versions. Besides this paragraph and a note for the Python version in the Requirements section, this page was not changed since the steps of ex- and importing stayed the same.

They should work for other versions too where syntax doesn't vary too much but seeing as we only had one small wiki to convert it's not widely tested. It works for all syntax in our TikiWiki though which was a horrible mix of pure wiki syntax, pure html and everything in between.

The known unsupported syntax includes tikiwiki syntax tables

All revisions of pages will be imported with their times and contributors.

The authors of the pages will be set to the TikiWiki authors. These may or may not exist in MediaWiki and anyone who then registers using this username will have those pages attributed to them.

Files uploaded to TikiWiki will have to be uploaded to Mediawiki and their links fixed manually. The script will output a list of pages containing file downloads.

Images from the TikiWiki are included as external images which involves changing the external images settings of your MediaWiki. This can however be set to only allow images from one URL source.

Requirements

 * Admin access to your TikiWiki
 * Sysop access to a MediaWiki installation
 * Access to the TikiWiki database and the capability to perform MySQL commands
 * Python
 * the 2019 version was tested with Python 3.6.1, 3.7.2 and 3.9.3
 * the original code at the bottom of this page used 2.5.1, with this patch from this bug to ensure it's parsed properly
 * The python conversion script

Exporting

 * To export from TikiWiki go to Admin (or Admin Home) then Wiki, and then choose the Export link under Export Wiki Pages.
 * This will produce a tar achive, export.tar, of MIME (RFC2045) message (RFC2822) files.


 * You will also need to create an XML dump of the metadata for the Tiki images. Assuming your database is "tiki" and your table prefix is "tiki_" then the following query will fetch the required data:


 * If you wish to exclude any pages from the export, perhaps in order to keep them private, then you will need an XML file specifying which pages to exclude. you can do this by hand or use the following query:
 * which will select pages with any restrictions, though you could specify particular restrictions. The script will exclude any pages whose names are contained in a &lt;field name='pageName'> element in that XML file.
 * which will select pages with any restrictions, though you could specify particular restrictions. The script will exclude any pages whose names are contained in a &lt;field name='pageName'> element in that XML file.


 * note: use the mysql commands with the '-X' flag to produce xml output.

Running The Script

 * If you want to keep any pages private you can use the XML file created above.
 * Copy the source to a file named tikiToMwiki.py
 * Run the script :


 * where
 * tiki source URL is the URL preceding all tikiwiki page URLs including the trailing slash. For example 'http://yourdomain.com/tiki/'
 * tiki export is the tar file produced by the TikiWiki export. If not specified then the script defaults to reading from stdin.


 * options are
 * -o output file the base name of the file(s) to be output - the script can divide the output into multiple small files so output files will be numbered. For example if output file is 'wiki.xml' the script will produce files called 'wiki0.xml','wiki1.xml' and so on. This will default to the name of tiki export with ".tar" replaced by ".xml" or to stdout if tiki export isn't given. If you specify "-o -" then output will be sent to stdout.
 * -k image file an XML file containing image metadata
 * -i tiki image URL is the (possibly relative) URL used to access images when using their ids or names. For example '/UserFiles/Image/tiki/'
 * The -n flag specifies whether to force pages not to have a table of contents. By default MediaWiki adds a table of contents to pages with three or more headings, you may decide not to use the table of contents to make pages more similar to the original TikiWiki pages.
 * -j new image URL a new URL for the image files (including trailing slash) if this is not set the old image locations will be used. You can use this option if you need to change the TikiWiki image file locations.
 * -m max maximum file size for the new files in MB. The default value is 1. MediaWiki has a default maximum import size of 20M.
 * -p private pages an XML file containing a list of any pages you wish to exclude from the import
 * if your wiki contains pictures you will need to run the script with both the -i and -k options
 * if you provide the tiki export file as a command line argument any internal links which are in the wrong case will be corrected (MediaWiki is case sensitive, TikiWiki isn't). If you use stdin to supply the tiki export then links cannot be corrected.

Importing

 * To import the MediaWiki XML file(s) use one of these import methods and upload each XML file.

Changing Settings

 * To allow external images only from one source copy  to LocalSettings.php.
 * To allow any external images copy  to LocalSettings.php.
 * Set the main page by editing MediaWiki:Mainpage
 * You will then need to fix any file download links. A list of any pages containing these links will be output by the script.

If anything goes wrong you can use the deleteBatch maintenance script to delete multiple pages. NB If you import pages which have previously been imported the pages will not be overwritten, you have to delete the pages and then import again.

Re-Use
© Crown copyright 2008 - Rosie Clarkson, Chris Eveleigh (development@planningportal.gov.uk) for the Planning Portal

You may re-use the Crown copyright protected material (not including the Royal Arms and other departmental or agency logos) free of charge in any format. The material must be acknowledged as Crown copyright and the source given.