On our webserver, we run a wiki for tracking various administrative bits. Today, we migrated it from MoinMoin 1.3 to DokuWiki. This was not entirely trivial but at the same time not that difficult. The following method doesn’t preserve history, users or attachments, but seems to basically work. The handling of categories could probably use a little work though.
First, find the latest revision of the files and move them to the right place. In
sh, this is expressed roughly as:MOINWIKI=XXX DOKUWIKI=YYY cd $MOINWIKI/main/data/pages for i in *; do r=$(ls -tr $i/revisions 2>/dev/null | tail -1); if [ "$r" ]; then cp $i/revisions/$r $DOKUWIKI/data/pages/$i.txt; fi doneNext, you’ll need to handle any categories manually and move them into subdirectories for namespaces. This could probably be automated by splitting based on the
(2f)s in the filenames.Since DokuWiki prefers lowercase filenames, go ahead and lowercase all the filenames, e.g.:
rename '$_ = lc($_)' *.txtusing this handy perl script. You can repeat this for each namespace/category.
Hack the markup. Create the following
migrate.plscript:#!/usr/bin/perl -ni.bak BEGIN { $readblank = 0; } $readblank = 1 if /^$/; # Fix line-endings for Unix $//; # Ignore all pragmas next if !$readblank and /^#/; # Fix different a href linking styles s/\[(http:\S+)\s+(.*?)]/[\[$1|$2\]]/g; # Fix lists that aren't indented enough s/^ \*/ \*/; # Fix ordered lists s/^(\s+)\d+\./$1-/; # Fix code blocks s/^{{{$/<code>/; s/^}}}$/<\/code>/; # Fix monospace/code text s/`/''/g; s/{{{(.*?)}}}/''$1''/g; # Fix headers s/^= (.*) =$/====== $1 ======/g; s/^== (.*) ==$/===== $1 =====/g; s/^=== (.*) ===$/==== $1 ====/g; print;and run it on each file (
find . -name "*.txt" | xargs -n 1 perl migrate.pl).Make sure your
local.phpsets$conf['camelcase'] = 1.You’ll need to move your attachments from the various
attachmentssubdirectories and move them into DokuWiki’smediasubdirectory and fix up the links.
That’s it!