Katipo Project Survival Kit

Katipo Developers Blog

Migrating from Phpwiki to Kete (part 2)

In the previous part of this guide, we created an export script which produced an XML formatted output of the current versions of pages in your phpwiki installation. If you havn’t done that yet, please read the first part of this guide. Now we are going to take that file, and import it into Kete, maintaining as much as the information as possible. We’re going to cover system settings, topic types, extended fields, privacy controls and import synonyms. So lets get started.

We’ll start by uploading that records.xml file we made in Part 1 to the server. Using an SFTP client (or scp if you use the console), copy records.xml to a folder inside the imports folder in the root of you Kete installation. The final location will look something like

/home/kete/app/your_app/imports/phpwiki/records.xml

(with the first 4 folders differing depending on your setup). Make sure you upload as the kete user (or whatever account is running your Kete installation) or Kete will have problems accessing/writing to that folder. If you can’t upload as the user, as root (if you can access that), run something like

chown -R kete /home/kete/app/your_app/imports/phpwiki

With that uploaded, lets then create a new basket to put these Phpwiki pages into. Login as an admin and at the bottom of the page, in the Administrators Toolbox, click add basket. Enter a title that will help easily recognize where these pages came from. The rest of the options should be fine if you are importing public topics, but if you exported the XML with the WILL_IMPORT_AS_PRIVATE constant in parseWikiToHtml.php set to true, then you will need to set Privacy controls to enabled at the very least. Finish creating the basket.

Now you need to set up some important synonyms for the import. These map what fields in the XML file go into the fields in your database. In the case of this import, we want pagename to be the title, and content to be the description of the topics it will be making. To set these, as an admin, click Reconfigure Site in the Administrators Toolbox, go to Advanced Settings, and then to Import. In the Description Synonyms, enter the following:

['content']

and then enter the following for the Title Synonyms:

['pagename']

If you already have synonyms in place, you may need to join then together like so:

['existingsynonym', 'othersynonym', 'pagename']

Once they’re entered, hit Save, and because you changed system settings, you’ll need to restart mongrels and backgroundrb processeses for the import to work correctly. If you’ve read this far, I’m going to assume you have a Kete installation you setup and you know how to restart your server. If not, check out the documentation at http://kete.net.nz/ .

Once restarted, we need to setup a few extended fields. In the Administrators toolbox, head to extended fields, an create three new ones with the following details:

Label: Author
Import Synonyms: author

Label: Creator
Import Synonyms: creator

Label: Last Modified
Import Synonyms: lastmodified

Leave the rest of the fields as their default. When all three are saved, the next step is to create a new topic type these topics will be imported as. Once again, in the Administrators Toolbox, click on topic types, and add a sub type of Topic. Give it a name and description that will clearly identify what these articles are. Create it, and scroll down to the section “Available form fields”. Tick all three of the new extended fields you added (Last Modified, Created, and Author) as optional, add them, and scroll down to reorder them how you want them to be shown.

Everything is now ready to be imported. Head to the basket you setup, and at the bottom, in the “Tools for basket” box select “import content into basket” and then “start new import”. After the initial instructions on how to import (which I wont explain) you’ll reach the form, where you can enter the following details:

Name of import folder: phpwiki
Delay between records: 10  (higher if you have a slow computer, lower if you have a computer with lots of memory)
Import type: Simple XML Topics
XML Path to Record: pages/page
Applicable Topic Type: [the new topic type you made]
Default Privacy Setting: [as before, make private if you exported the XML with the WILL_IMPORT_AS_PRIVATE constant in parseWikiToHtml.php set to true]

Fill in the rest of the fields to what you want, and hit Import. And you’re done. If everything was set correctly, within 30 seconds you should see the page update informing you how many records have been processed. If you set a high processing delay, it can take well over an our depending on how many records you wiki has. Once its finished, your topics will be accessible. That said, there are a few gotchas with this process.

  1. Importing private topics does not, as of writing this article, update the zoom records correctly. So after importing any private topics, you will need to rebuild your zoom index’s. Check out the last 3 steps of this troubleshooting guide.
  2. Links that used to work on the old wiki don’t know where to point to, so in the export process, it changes the links to searches within Kete (which it knows how to perform). So whenever you click a link in an imported topic, it will be searched for, rather than being taken directly to it.
  3. The import process messes with links which contain an ampersand (which if you import as private will be all links). To fix this, you can run a set of console commands in a production console. Enter the console by running  ’script/console production’ in your Kete root directory, and copy and paste the following lines one by one (might take a while): http://gist.github.com/3359

Any question? Feel free to ask.

Leave a Reply

You must be logged in to post a comment.


Katipo Developers Blog is proudly powered by WordPress
Entries (RSS) and Comments (RSS).