|« Advanced debugging||AppDomain.FriendlyName and vshost »|
Experiences in moving to WordPress 1.5
Experiences in moving to WordPress 1.5
Yesterday, I moved my blog over to the new release 1.5 of WordPress. I had been using version 1.2.2 of WordPress previously, as packaged in Debian unstable. Now I wanted to use the downloadable version, to be more flexible in the future to do experiments.
The first problem I faced was that I didn't want to have any downtime while I was playing around with the new version, porting my theme and everything. So started off by cloning my complete WordPress database in MySql by dumping it to an SQL file (I do that every night for backup purposes anyway) and using that file to create an exact copy of the database. I also had to grant the database user I'm using for WordPress the same rights on that new database that he has on the old one.
I untared the new distribution into its own folder and created a wp-config that used the new database with the old user account. I created a new alias in my Apache config to access the new installation in its path, leaving the old alias untouched. I accessed the new URL and I could immediately see my old blog content in the new theme! The main problem was that all the links were still wrong because I hadn't yet changed the WordPress and blog address configuration settings, plus my old permalink structure wasn't there anymore. After a little bit of fiddling, I managed to access the management frontend of the new installation to change the settings and recreate the permalink structure (or rather the correct .htaccess file).
Now I created a new theme by copying the Classic theme folder to a new name. I copied my own style sheet to the new theme folder (calling it style.css) and added a header to it:
/* Theme Name: Oliver Theme URI: http://sturmnet.org/blog Description: Version: 1.0 Author: Oliver Sturm */
In my old 1.2.2 setup, I had made considerable changes to the index.php and also some small ones to the comments. With the old blog in another browser window, I went and recreated these changes in the new theme system. That wasn't very complicated, as the new files have mainly been split into parts. It's easily possible to recognize the old content in them.
In the old installation, I had also used several plugins, most of which I could easily copy to the new plugin folder. These are the ones that I could use without problems:
The one plugin that had some problems was Syntax Highlighter Enscript, which relied on a specific formatting that the old WordPress version apparently applied to <pre> formatted text. This seems to have changed and I fixed the plugin for that (you can find the fix in this comment).
Two other problems I found were in WordPress itself. Firstly, something that hadn't originally worked in WordPress 1.2.2: private posts didn't appear in the blog, even when the user was logged on. I had at some time applied a fix for that problem to my old WordPress, but now I couldn't even find that fix any longer. I read a lot of articles in the WordPress support forums before I found the fix for this problem: adding a line saying
get_currentuserinfo(); in line 501 of wp-includes/classes.php (right after the comment line saying
// Get private posts) did the trick this time.
The second issue I found seems to be a bug in WordPress. As you can see, my category list is shown as a hierarchical structure, with the child categories indented a bit. This specific layout suddenly wouldn't work at all in 1.5, and the categories appeared to be unsorted. After looking around quite a while for the source of the problem, I found it: the file template-functions-category.php has a problem around line 275, resulting in the fact that the hide_empty parameter must effectively be 0 (zero) for any of the sorting and hierarchical view code to work. I'm quite sure that this is a programming mistake and I'll go report it when I find the time. (Why do I have to register to post in the support forum? If it was easier to just drop someone a line, I'd probably already have done so.) At the moment, though, I worked around the problem by adding these parameters to the call to the
wp_list_cats function in sidebar.php:
children=1&hierarchical=1&sort_column=name&hide_empty=0. Problem is, now my test category is visible although it shouldn't be... That'll go away when there's a real fix in the future.
So, that's all. Oh, of course, I forgot: Finally, I switched the new WordPress installation over to be the active one. I simply changed the WordPress and Blog addresses once again and recreated the permalink structure. Then I switched the aliases in Apache around so the new blog would be the active one and voilÃ¡: one restart, no downtime at all, new blog software!