Converting Drupal 6 to WordPress
I’ve just moved my blog from Drupal 6 to WordPress. There’s several reasons for this:
- I was only using Drupal in the first place to get some experience using it. It’s a great CMS but is overkill for just running a blog.
- WordPress comes with Akismet for reducing comment spam out-of-the-box.
- I just got a Nexus 7, and there’s a nice WordPress app for Android.
I wasn’t, however, keen on losing my old posts and comments. No problem, Drupal and WordPress are both open source and widely used, there’ll be tools to convert between them, right? Actually, not so much.
The best thing I found was this post on Migrating Drupal to WordPress and the associated Java script (that’s a script, written in Java, not a JavaScript file). I had to tweak the code a bit to get it working, I’ve put the resulting code on Github.
I’m not really a Java guy, so getting it to run was new for me. Here’s the steps I took (on Ubuntu 12.04):
- Dumped the databases for my existing Drupal and a clean WordPress install from my web server to SQL files on my local machine.
- Imported both files into a new database on my local machine.
- Downloaded the .java file
- Edited the database credentials in the .java file to match those on my local machine (wpPrefix variable, drPrefix variable and return line of getConnection method)
- Installed the dependencies required to compile and run the file
`~/$: sudo apt-get install openjdk-6-jdk libmysql-java` 6. Compiled and ran the file
`~/$: javac -cp . DrupalToWordpress.java<br /> ~/$: java -cp .:/usr/share/java/mysql.jar DrupalToWordpress` 7. Exported the resulting WordPress tables from the local database, and imported them back into the database on my web server
A bit of a palava I think you’ll agree, but as you can see, it worked!</ol>