Migrating from Drupal 6.2.x to WordPress 3.2.x 5


After careful consideration I decided to migrate my small website from Drupal to WordPress. The main reason why I selected Drupal some Years ago was it’s modules and programmability. Actually I did not program it at all. But I did use some modules.  Now, when Drupal 6.2 was superseded by Drupal 7 I just considered upgrading.  Unfortunately almost all modules I did use were not Drupal 7 compatible.

Then I had this long irritation with my picture gallery. I have a Gallery2 installation, but it was not really nice experience. Too much hassle and I did not find a theme that I liked. Did not feel like making one too. I tried Gallery3 also, but it is not really ready.  So I thought about getting gallery and website as one package.  Unfortunately I did not find anything I liked for Drupal.

WordPress has a Gallery plugin that seems nice – NextGEN Gallery so WordPress migration was in order.

Installing WordPress and migrating DB was the easy part. As my site is small and does not have any customisations, I had to copy over posts, and some comments.  No categories. I did find some tutorials and used one How to migrate from Drupal 5 to WordPress 2. As it is for older versions of Drupal and WordPress some database tables have changed. I use MySQL for database storage.

For a less manual option, take look at:  http://modeling-languages.com/migrating-drupal-6-to-wordpress-3/

Steps I used:

  1. Prepare two databases in one server – drupal and wordpress.
  2. Log in as administrative user.
  3. Empty wordpress database tables from data:


use wordpress;
delete from wp_posts;
delete from wp_comments;

  1. I had no categories and its DB structure has changed, so I skipped this step.
  2. Copy over posts:


INSERT INTO wp_posts (id, post_date, post_content, post_title,post_excerpt, post_name, post_modified) SELECT DISTINCT n.nid, FROM_UNIXTIME(created), body, n.title,teaser, REPLACE(REPLACE(REPLACE(REPLACE(LOWER(n.title),' ', '_'),'.', '_'),',', '_'),'+', '_'), FROM_UNIXTIME(changed) FROM drupal.node n, drupal.node_revisions r WHERE n.vid = r.vid;

  1. Copy over Comments:


INSERT INTO wp_comments (comment_post_ID, comment_date, comment_content, comment_parent, comment_author, comment_author_email, comment_author_url) SELECT nid, FROM_UNIXTIME(timestamp), comment, thread, name, mail, homepage FROM drupal.comments;

  1. Finish up, those repeated steps are there just to make sure, post names get updated correctly:


UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '_', '_');

 

Configuring WordPress to work almost the way I liked is another story. Some helpful plugins I use are:

Custom sidebars – to have a different sidebar on every category. Right now I just use different custom menu for every category and one if no post is selected.

NextGEN Gallery – for a simple photo gallery

Easy Theme and Plugin Upgrades – I have not seen it do any useful work actually, but lets wait and see.

The good thing is that I had to use a lot less plugins than on my old Drupal site. Good for future upgrades, I hope.

One last thing was redirecting old URL-s to new ones. This can be done in .htaccess file as shown in the following example:

<IfModule alias_module>
Redirect permanent /node/31 http://www.ogalik.ee/rpm-uninstall-packages-listed-more-than-once
</IfModule>

 


Leave a comment

Your email address will not be published. Required fields are marked *

5 thoughts on “Migrating from Drupal 6.2.x to WordPress 3.2.x