Friday, March 23, 2007

Migrating Moniwiki to MoinMoin

I had been using Moniwiki for our company for a while because the installation was quite easy as it was PHP based. However, I found out that document versioning didn't really work. It may have been a configuration issue but I took this opportunity to take a look at MoinMoin, as it was being used by Ubuntu and looked well supported.

The server was running Debian stable and MoinMoin was in the repositories. Installing was simple using aptitude. Configuration was a bit more involved as it required copying and editing files.

The new wiki site was pleasantly more responsive. The next task was to move the data in Moniwiki to MoinMoin. Upon inspecting the data repositories, I realized that Moniwiki stored the data in individual files with the WikiWord as the filename while MoinMoin organized that data with the WikiWord as a directory with the actual content under the revisions directory. I cooked up a quick script to migrate the data. I also ran the previous file through a 'tr' to filter out non ascii characters, which was present in Moniwiki and showed up as errors in MoinMoin.

The next problem was the way non WikiWord links were defined. In Moniwiki these are written as [Link to Text] while MoinMoin used ["Link to Text"]. I had a couple of those so I simply edited them to the MoinMoin syntax. It turned out to have another problem as Moniwiki saved it as a file named LinkToText while MoinMoin stored is as Link_to_Text. I simply renamed those links and MoinMoin powers the wiki now.


#!/bin/sh

SRC=/usr/share/moniwiki/data/text
DEST=/var/www/moinwiki

PAGES=`ls $SRC`
cd $DEST

for i in $PAGES; do
mkdir -p $i/revisions
echo "00000001" > $i/current
#cp $SRC/$i $i/revisions/00000001
tr -cd '\11\12\13\40-\176' < $SRC/$i > $i/revisions/00000001
done
Post a Comment