Nov 17
Converting BlogCFC to Wordpress
Posted by James Netherton | Saturday 17 November 2007 9:11 AM | In ColdFusion
I’ve been experimenting with Wordpress recently and I wanted a way of migrating all of my posts and comments across from BlogCFC. Wordpress does have an RSS import feature which does an Ok job but I wanted to preserve data such as posts that had not been released, comments disabled etc.
There’s already a couple of migration tools written by some ColdFusion folks. Unfortunately it looks like the Wordpress database schema has changed significantly since they were written. Therefore, I decided to hack together my own utility.
Some disclaimers before I introduce the tool:
- It’ll only run on ColdFusion 8, although it would be easy to alter it to run on other versions.
- It’ll only work with MySQL databases.
- I haven’t tested it with the latest version of BlogCFC.
- Tested with Wordpress 2.3 only
Here’s a small guide to get started……
1. Download the utility from the link below and extract the zip archive somewhere under your web root.
2. Configure two ColdFusion data sources. One for your BlogCFC database and another for the Wordpress database (assuming you have created the Wordpress database of course).
3. Make some edits to Application.cfm:
- Change request.blogcfcDSN to equal the BlogCFC data source name
- Change request.wpDSN to equal the Wordpress data source name
- You may have installed Wordpress with the option to use a database table prefix. If you did this, set the prefix value in request.wpTablePrefix.
- Set the GMT offset hour value to be applied onto post and comment dates in request.GMTOffset.
- Set request.blogURL to your current BlogCFC root URL. Do not add a trailing ‘/’ character!
- Wordpress lets you define your own URL format which makes it possible to keep all of your old BlogCFC post links in tact for SEO purposes. Uncomment the request.blogURLFormat variable if you wish to do this.
4.Execute index.cfm from wherever you extracted the code to, and the migration process will run. It will display a summary of categories, posts and comments imported when finished.
If everything has gone according to plan you should be able to fire up your Wordpress blog and you’ll be presented with all of your BlogCFC posts, categories and comments.
If you chose to uncomment the request.blogURLFormat variable in Application.cfm, browse to the permalinks administration area and set a custom structure of:
/blog/index.cfm/%year%/%monthnum%/%day%/%postname%/
You’ll then be able to browse your Wordpress blog using BlogCFC style URL’s.
Some remaining tasks might be:
- Migrate across any images and attachments
- Redirect RSS traffic
I’ve not done a massive amount of testing with this so if there’s any bugs or issues, let me know.
BlogCFCConvert.zip
5 Comments
[Post comment]
1
Posted by Critter | Friday 11 January 11:01 AM
I’ll be giving this a look this afternoon. Thanks
2
Posted by doug | Sunday 17 February 22:02 PM
Worked great for me!
discussed the experience here:
http://dougr.net/?p=58
3
Posted by John Wilker | Thursday 16 October 20:10 PM
Was your BCFC Database, set up with body and morebody as nText? Mine is and can’t recall if I did it. But in either case, the SQL doesn’t like those. They can’t be grouped, so I get an error that they can’t be used unless aggregated or something.
Any thoughts? My SQL hackery is pretty rusty, casting doesn’t seem to work either.
4
Posted by James Netherton | Thursday 16 October 21:10 PM
Hi John,
On the MSSQL BCFC database I tested on, the body and morebody fields were of type text. Maybe altering the columns to this type will do the trick.
5
Posted by John Wilker | Friday 17 October 18:10 PM
Strangely SQL won’t let me convert from ntext to text. weird.
I’m confirming that I’m on SQL2005, since then I could try nvarchar(max)
Weird I can’t recall if I set it as ntext or what, it’s been so long. grrr. LOL
Thanks for the insight.