Migrating from Mephisto to Dotclear 2
By scox on Tuesday, June 10 2008, 02:42 - code - Permalink
It's been a while since my last post. Beside the fact that I was busy, the reason preventing me from posting is that the blogging engine I was using (Mephisto) was in a bad shape. It seemed unmaintaned, managed to consume all the server memory and didn't survive a rails upgrade.
That's why I've decided to migrate to Dotclear 2, which seems to be a nice and clean blogging engine. However, in the migration process, I didn't want to lose:
- All my previsous posts (both published and pending)
- All the comments
- Associated metadata (categories, tags and so on)
Dotclear has a nice builtin plugin called Import/Export which let you save and restore backups of your blog. All I did was writing a Ruby script that generates a dump of the Mephisto database using ActiveRecord in the same format as Import/Export, ready to be imported. It is available here and works in the following way:
- Place it under the script directory of your Mephisto rails root
- Edit the first lines (set your Dotclear 2 login and blog id)
- Run it and redirect the output to your favorite location:
ruby script/migrate_to_dc2.rb > public/dump.dc2
- Retrieve the dump file (e.g. dump.dc2) and import it in the "Import/Export" area, under the Import a single blog section.
That's it, you're done. It should have imported all your blog posts (and preserved publish dates as well as many other attributes), comments, metadatas etc.
I also wanted to maintain backward URL compatibility with Mephisto. A couple of mod_rewrite rules did the trick:
# Mephisto URL compatiblity RewriteEngine On # Feeds RewriteRule ^/feed/atom.xml /feed/atom [L,R=301] RewriteRule ^/feed/all_comments.xml$ /feed/atom/comments [L,R=301] # Posts RewriteRule (^/200\d.*) /post$1 [QSA,L,R=301]
That's all. I hope it will be useful to anyone wishing to migrate to Dotclear 2, as the process of creating that script is quite annoying :)
Comments
The link to your export ruby code is invalid...
Fixed. Thank you