Migrating from Xoops to Word Press

This is the scratchpad I’m going to use to keep notes to myself as I migrate Sex and Podcasting from Xoops to Word Press on my IIS server (Win2003). This is extreme geekness, not good reading unless you’re trying to do the same thing.

Read on for the geek stuff…

I like Word Press and probably would have done all the family blogs in that environment had it been around when I got started a few years back. It’s open source, free, has a very active user community and it works better as a pure blogging platform than Xoops does. Xoops hasn’t gotten hip to search-engine-friendly URL’s yet, and for a blog is kinda like trying to drive to the grocery store in a 747.

Getting Word Press running under IIS

IIS is, of course, a little quirky for Word Press — which is built with Linux in mind. But it’s not bad. Here’s the stuff to tweak to get IIS and Word Press to cooperate with each other (at least in my case).

— Set the permissions on the server folder to give read access by your Internet Guest account before copying the WP files into it. In general, most of the problems I’ve encountered are due to differences in the way that IIS handles file permissions.

— Ignore the “don’t have permission to create folder” error message during the installation process – it’s trying to do something dumb with themes. No worries.

— set the cgi.fix_pathinfo=1 variable in the PHP.ini file in the Windows directory. This will make search-friendly URLs work when you tweak it in the Permalink settings (I was getting “no input file specified” errors when I tweaked the Permalink setting until I changed that). Check to make sure this doesn’t break anything in your OTHER PHP applications (like Xoops). Didn’t for me.

— set the [mail function] parameters in php.ini to point at the SMTP server of my email provider. That’s it. No patches, no SMTP emulators.

Here is the “before” version of the file;

SMTP = localhost ; for Win32 only
smtp_port = 25
sendmail_from= me@localhost ; for Win32 only

Here’s the “after” version;

SMTP = SMTP.mail-server-name.Example.com ; for Win32 only
smtp_port = 25

sendmail_from= MyEmail@Example.com ; for Win32 only

Task 2 – importing the entries from the Xoops blog to the WP blog

This turned out to be easy because of the way I had the original blog set up. I had no posts “below the fold” and used the RSS-feed import process to pull the posts in. If you have stuff “below the fold” an approach might be to edit that stuff up above the fold I suppose. That would be a serious pain in the neck though…

My conversion involved editing the rss-import.php file to point at the Feedburner feed from the old blog. It doesn’t indicate this in the documentation, but the import works fine if you point it at a feed-URL rather than a local XML file.

Note: make sure to set your Xoops RSS feed to export ALL of your posts. I used RSSfit to do this. This could present a problem if you have more than 100 news entries, as RSSfit only allows a maximum of 99 entries in the feed. I workaround might be to export the first batch of 100, then delete them, export the next, etc. I didn’t need to do this because I only had about 40 entries when I did this stuff.

Migrating the URLs

I set the Word Press site up in a separate directory from the Xoops stuff. My approach was to get all the of the kinks out of the new site and then use IIS to point the domain at the new site. So I set everything up, using WP.sexandpodcasting.com as the URL, and then changed the host headers around in IIS so that www.sexandpodcasting.com pointed at the new site when I was ready to go.

In order to preserve the URL of the RSS feed for subscribers, I created a directory/document in the new site that mimicked the RSS feed URL in the old site. In my case, the feeds were as follows;

www.sexandpodcasting.com/rss.xml — the “public” URL that people subscribe to — in reality a redirect to…

feeds.feedburner.com/SexAndPodcasting — the Feedburner-feed URL. Feedburner is looking at…

www.sexandpodcasting.com/modules/rss/rss.php — the RSSfit-generated RSS feed on the Xoops site, which I mimicked by creating stub directories and a document in the new site, which was redirected (in IIS) to…

http://www.sexandpodcasting.com/wp-rss2.php — the RSS feed generated by the new Word Press software. Thus, I was able to spoof Feedburner into looking at the new feed, and not disturb either my historical statistics, or the users who’d subscribed to the feed.

http://www.sexandpodcasting.com/modules/news/ — I set up a dummy directory in the WP folder and redirected it to the root (http://www.sexandpodcasting.com) — so’s to provide a place for search entries to land.

Bug (or “feature”) fixes

Bug — enclosures don’t work correctly, and don’t delete, in WP

Word Press 1.5.2 doesn’t do enclosures correctly — I discovered this when I cut the new site in and it broke my Feedburner feed. WP had added an enclosure for each of the MP3 links I had in the article — which violates the standard, results in an invalid RSS 2.0 feed and cause Feedburner to choke and stutter a little bit. The fix was twofold. First, I used mySQL Control Center to go into the “wp_postmeta” table and delete all the “enclosure” rows that WP had created during the import process. Second, I “broke” the auto-enclosure function in WP by using this hack by user “andper” on the WP site;

“Well, if any of you are like me and don’t want the “enclosure” feature *at all*, here’s an amateur solution.

All you have to do is open your wp-includes/functions.php file and take a look at line no. 766. There’s a preg_match_all function which is responsible for “discovering” the audio or video file(s) linked in your post. You have to “break” that function somehow, for instance, add an additional “p” after “http” so it’ll read “httpp”.

Now WP won’t find any of your media files linked in your post anymore, nor will it include them in your blog’s feed, plus the delete button for the “enclosure” custom field in the administration panel will automagically start working.”

Users get dumped into a weird place when they log in after they register

I dunno, maybe it’s just me — but the way WP handles registered users after they log in just isn’t right. So I edited wp-login.php to dump users into the “write a post” page instead of the dopey Dashboard page:

change line 159 from
$redirect_to = ‘wp-admin/’;
to
$redirect_to = ‘wp-admin/post.php’;

Surprises

Sex and Podcasting is a podcast site which has about 1200 users as I write this — so one of the things I was trying to do was avoid disturbing the RSS feed. I thought I had it nailed. All the entries were the same, the dates were the same, etc. But I didn’t, and as a result the whole RSS feed was republished as “new stuff” for people who had subscribed.

This probably isn’t a real big deal for most folks, but because I have almost 30 shows in the RSS feed, and each show is about 10 mBytes, I launched a storm of downloads against my server. Mostly this is because the bulk of my subscribers are using iTunes as their RSS reader and lots of those folks have iTunes set to the “download everything that’s new” setting. So I kicked off about 200 GIGA bytes of downloads. Argh. My abject thanks to the folks at IP House (IPHouse?) for their patience.

Getting images to upload in a Windows environment

I had all kinds of trouble getting the “upload” function to work in my Windows environment. I got a message that included the string “upload.php on line 170 can’t open stream” which turned out to be a permissions problem — the folder that gets the uploaded files needs to have Write permissions assigned to the Internet Guest Account (IUSR_blahblahblah). I spent a whole hour banging away on the same directory in a different blog (mine instead of Richard’s — gah).

I didn’t like the native upload module — it works, but it’s really bare bones so I went hunting for a plug-in and came across PhotoPress which did all the stuff I wanted. But both the native module and Photopress had all kinds of trouble creating the thumbnails — bombing with errors like “Filetype not supported. Image not resized”. Turns out that was caused by my PHP configuration. I didn’t have an extension called the GD library turned on. Here’s the post that got me squared away. In my case I didn’t have an “extensions” subdirectory of C:/PHP directory on my machine so I had to;

— create the “extensions” directory,

— go grab the php_gd2.dll file from my PHP distribution download,

— put it in the new directory,

— edit c:/windows/php.ini to uncomment that php_gd2.dll extension, and

— edit the extension_dir = “c:/php/extensions”

All good now.

Getting the whole post into the in the RSS feed

I ran into a problem with the tags in the RSS feed — it was always using the excerpt even when I wanted the whole post to be in there.

Turned out to be a bug int the wp-rss2.php code. Note to self; must remember to reapply the patch contained at the bottom of this thread on FeedBurner’s site — if the thread is gone, search on “rss_use_excerpt”.

Getting rid of goofy treatment of quote characters in the RSS feed

The RSS feeds have all kinds of numeric substitutions for quote characters. Got rid of them by editing the wp-includes/default-filters.php file and comenting out these two lines;

#add_filter(‘the_content’, ‘wptexturize’);
#add_filter(‘the_excerpt’, ‘wptexturize’);

that wptexturize stuff is no good for RSS feeds