Almost There

I’ve managed to migrate MomEx posts, which run on WordPress, to Drupal 5.9 on my test server. Whoopee!

I used WordPress Import, a pretty powerful tool which is still in development mode. On the surface it’s a straightforward process of installing the module, uploading your WordPress .wxr file and then mapping out which posts are ‘owned’ by which users (aka authors). It then transfers both posts and comments associated with it.

It becomes a hell of a lot more complicated though when your .wxr file is 17mb. like mine, and I have nearly a hundred different subscribers and authors.

The actual migration is extremely resource intensive, so to upload the big file and handle the job you need to tweak these things: One, php.ini to allow for a large upload (the default is only 2mb.), and Two, Drupal’s settings.php to allow for both a longer session time and to for more RAM to do the job, otherwise you will receive errors midstream like I did, and only transfer, say, half your posts or an increment instead of all.

To be specific, I changed the line at php.ini from this:

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

to this:

; Maximum allowed size for uploaded files.
upload_max_filesize = 64M

Then you’ll need to add these two lines to your settings.php:

ini_set('memory_limit', '128M');
ini_set('max_execution_time', 0);

Naturally you’ll need to restart the webserver and make sure everything, including your other sites hosted on it, is fine. If you’re doing this on a live server (meaning there are people reading the website), you need to do it quickly, then return the settings to their original immediately.

It so happened I bought a new domain so I’ll be practicing on that one first before finally jumping onto MomEx.

Another issue that’s been licked is the ‘Clean URLs’ problem. As I use Lighttpd, using .htaccess rules is out of the question, but I managed to find a good tutorial here, and another one that deals with imagecache issues, an important feature to handle images, using Lighttpd here.

There’s only one more issue I need to fix before finally getting it all together.

MomEx’s pageviews are counted by a WordPress Plugin called Clickcounter, which as the name suggest, registers a ‘click’ everytime someone views a page and displays it on the page plus stores it in the db.

A transfer to Drupal will negate all the registered hits! Drupal has its own click counter equivalent I’m sure, and I could probably tweak it to start counting where it left off, but that would require some MySQL magic which I’ll have to investigate.

I know it sounds a little vain to want to keep all those registered hits but hey, we worked for those, some of which have gone up to the thousands. It’d be a pity to just lose it all.

When I do get that fixed there’s the issue of finally migrating the site while it’s online. That means I’d have to take it down for a a day or two just to make sure everything works. I can probably start on it in the morning and if I don’t get it working, use the backups and go back to the old site in the evening, then start again the next day. The documentation I’ve read never mentioned these, as they all assumed you’d be migrating to a different domain. Migrating from WordPress to Drupal using the same domain is something new, so I plan to document it.

As with most daunting techie tasks I’m usually overwhelmed at the start but I eventually get over my wussiness and fix it, usually realizing it wasn’t all that hard as I thought it was. In other words, I’m confident, and let’s face it, getting something to work when a minute ago it seemed impossible feels GREEEAAAAT.

I’m excited about the fancy stuff I can implement once I get it on Drupal for sure, but the tremendous geekiness of it all is partly why I’m doing it as well I think.

Leave a Reply

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