Migrating from Textpattern to WordPress
Part of setting up my new blog was to migrate all my old articles from Textpattern to WordPress. As with all migrations and updates, I was somewhat cautious, thinking it would probably take a lot of time and effort. Ahh well, I’ll never know if I don’t try!
Turns out I was right. WordPress actually provides a script to do the migration for you. This script should take care of importing categories, users, posts, comments, and links (blogroll). All you have to do is fill in a small form with your Textpattern database details – database user, password, name, host and any prefix you might have used on your Textpattern tables – and hit Import! However, when I ran it, it did nothing. Yup, that horribly annoying problem that all developers absolutely loathe. The script ran… and did nothing. It kept telling me it had not imported anything but it didn’t give me any reason as to why that might be the case nor did it give me any errors or warnings. Urgh!
So I searched Google. I found out that a few people have had issues with this script. A couple of other people (such as Alex Brie) have written their own instructions and even scripts (or at least modified the one that comes with WordPress). Most of the advice I read on the matter said you should have both your Textpattern and WordPress tables in the same database for the script to work. Apparently that’s actually not necessary but I tried it anyway. Still nothing imported. I tried using the modified import scripts that I found… still no luck. Argh!
At this point I was starting to get mildly frustrated that something that should be quite straight forward just wasn’t doing anything for me. A lot of the comments on the blog posts I was reading had people quoting errors or saying that they’d finally got it all working. I didn’t get either. It was at this point that I surrendered to my geek-soul and opened up the PHP import script in Dreamweaver. I read through some of the code and eventually found some places where I could stick some debug code in. First thing I tried was to output the values that I’d entered into the import form (my Textpattern database details). BINGO. There was my problem. My database host includes slashes and colons and there was a nice wee line in the script that was scrubbing all those characters out. Grrr…. I changed that line from:
1 | add_option('txphost', sanitize_user($_POST['dbhost'], true)); |
to:
1 | add_option('txphost', sanitize_user($_POST['dbhost'], false)); |
I guess whoever wrote the script didn’t realize that some of us have complex database hosts!
Anyway, that seems to have fixed the problem at least in my case. The rest of the script worked great. So now, as you can see for yourself, all my old articles written on mindtrip using Textpattern are now sitting here in Wordpress! Awesome.
April 2nd, 2008 at 5:27 am
The long-awaited latest version of Wordpress, version 2.5, was released the other day. It’s better in a lot of ways (I’m running it now). It’s also got multi-upload, something that WP 2.3.3 was seriously missing – good for people that upload lots of photos.
There’s also an excellent plugin for WP called Anti Spam Image that means you can enable non-admin-approved comments on your blog without worrying about spam comments – http://www.infor96.com/~nio/archives/369. Good for enabling post discussions!