Wordpress -> Drupal

This is my script for migrating from Wordpress to Drupal. I know that there is already a migration script out there, but I still wrote my own for a few reasons:

  • My needs are simple, and I knew what I wanted.
  • I wanted to migrate comments and pingbacks if possible. This turned out to be easy.
  • I wanted to learn more about coding for Drupal.
  • I’d already started writing it when I saw Borek’s migrator.
  • I wanted to migrate straight to Drupal 5, not 4 first.

So here it is.

Limitations and bugs:

  • Attached files are copied by requesting them off the old server. But thumbnails aren’t migrated too.
  • Pages aren’t migrated. But I’m sure this would be a piece of cake to fix
  • I put dumped my wordpress tables into my drupal database (They are all prefixed with wp-). This is messy, but while Drupal’s multi-database system is a cool and would be perfect, it’s unworkable when you are debugging. Errors seem to be hooked in drupal, and if you have a broken SQL query (for example) the error handling code hooks Drupal themes, which aren’t findable in the alternate-db world you are visiting.
  • All blog posts are migrated to a single user on the other side.
  • I’m pretty sure that I didn’t solve the character encoding issues, just sidestepped them…
  • I didn’t look into Drupal 6 compatibility.

Drupal Migration

As should be obvious to non-feed readers, I’ve migrated my blog to Drupal. This fits in with my greater plan of organising myself and moving into digs this holiday. Drupal is an awesome CMS - or maybe a better description is “the only decent CMS”. I’ve set up and maintained a few drupal sites, and have been very impressed with it.

I’ve yet to migrate all my previous blog-posts across, but by the time you see this post, that’ll be done. Vhata has walked this road before me (albeit from Serendipity), and I intent do follow his advice.

In the past, I mantained my Wordpress blog as an SVN install. This allowed me to install plugins with svn:externals, which made upgrades a doddle. Drupal uses CVS, so this approach wasn’t an option. After months of procrastination, I investigated config-manager. With it, I built a recipe for downloading drupal and all the modules I use with it. Then I committed this as a bzr tree, so that I could base all my sites on a common base. To install a module, I bzr mv modules/foo drupal/sites/all/modules/.

Now to update all my drupal sites, I update my config-manager recipe, and build a new master tree. Commit it to the repo, and push to launchpad. And then bzr merge in all the sites. It’s pretty quick and painless.

For anyone who’s interested, the modules I’m using are:

So far I’ve had to write a drupal module to support amatomu, and it was a bliss. Drupal’s API and code is some of the neatest PHP I’ve ever had to work with.

I think I’ll be happy here :-)

Syndicate content