Migrating Habari to WordPress

While of course we never like to see anyone give up on Habari, it’s obviously not going to be the perfect platform for everyone. Hopefully most people will test it out before they make a final switch, but for those who get stuck and wish to switch back to WordPress (and we know you’re out there), I’ve finally throw together a quick script that should help.

Things this migrates:

  • Posts – published or draft
  • Pages – published or draft
  • Comments – approved only
  • Tags

A few caveats: this is MySQL-only, if you’re using Habari on Postgres or SQLite I’m sorry. It wouldn’t be especially difficult to change, I just have no interest in doing so – it suites my purposes. It’s also quite hacky. There’s very little error checking (make that practically none) and it prints output in plain text. It’s also not a plugin, I wrote it as a one-off script that you use and immediately trash because that’s exactly what you should do with it.

Also note that it writes directly to the WordPress database tables, it uses none of their API functions. That means the slightest schema change could (and probably will) break the whole thing and that things like filtering and other plugin actions aren’t performed. I was using the trunk build of 2.9-rare, so roll back to about r11867 if you have problems.

Finally, it will set the owner of a post to an existing WordPress user with the same username if one exists – if not it will create a new user account that you can then manage any way you like.

So how do you actually use it? Well, you dump it in your Habari root directory, edit the array at the top so it can connect to the MySQL database your WordPress instance is installed in, and you load it up in your browser. You should see a bunch of junk about things it finds – and hopefully no MySQL errors along the way. If you see any errors, you’re on your own.

On my VPS I was able to import my blog back into WordPress in a matter of about 2 seconds. For those who want or need to switch back, best of luck to you, hope this helps.

Snag the script over here: wp_migrate_script.php

6 Responses to “Migrating Habari to WordPress”

  1. …te the old Habari post ID to the new Wordpress ID… Whoops.The script can be found via my original post, it’s just been silently updated in place.Again, best of luck to anyone using it&#8…

  2. Khaled says:

    Not that I’m thinking of switching (I came by looking for something else entirely), but your links ain’t working…just as a heads up.

  3. Chris Meller says:

    Does now. Thanks for pointing it out!

  4. [...] I did a quick google search and found a migration script to migrate habari to wordpress: http://chrismeller.com/2009/08/migrating-habari-to-wordpress [...]

  5. [...] with no exit strategy back from whence they came. Chris Meller produces a useful PHP script to help traitors and non-believers migrate back from Habari to [...]

  6. [...] database destroyed and started again using Chris Meller’s script to convert from Habari to [...]

Leave a Reply

Post Meta

8-22-2009
Date
12:59 am
Time
1040
Views
386
Words
Comments
Comment Feeds