Upgrading MoinMoin from 1.5.x to 1.9.x

This is my quick attempt to document this before I forget. I used to like MoinMoin as time goes by, I have gotten to hate it a bit more every day. This post however is not a rant against it but a quick and dirty guide to fixing it when upgrading. This was all done on Debian so your mileage may vary.

First get the content of your wiki copied over to the new system with rsync (my migration was not an upgrade of an existing Debian system but a new VM instead). Remove all python compiled files (*.pyc). Copy this file in your wiki root folder : cp /usr/share/pyshared/MoinMoin/script/moin.py .

Then execute the following: python moin.py maint cleancache. This should not return anything critical, if it does, you’re on your own (keep in mind errors are usually not too obscure). Then comes the migration part: python moin.py migration data. This will throw and error if you don’t have that file: data/meta. If it doesn’t exist, create it and put that into it: data_format_revision: 1050800. Once done, execute again, you should now have a file called: data/rename1.txt, edit it and rename page and the right side of the lines if needed. Then rename that file rename2.txt and run this again: python moin.py migration data. This should now create a folder called: data.pre160/ which is your old stuff.

If you are happy with what you see on your new data folder (change permissions to www-data:www-data before browsing it), delete the data.pre160 one as it is not needed anymore.

Last but not least, you might have references to self: on some link, just sed files and delete that.

for i in */*; do if [ -f $i ]; then sed -i -e “s/[wiki:self:([^]]*)]/[[1]]/g” $i; sed -i -e “s/[[([^] ]*) ([^]]*)]]/[[1|2]]/g” $i; fi; done (note: this is a FreeBSD command, thanks Jef 🙂

And voilà 🙂