Upgrading WordPress1.5.2 to WordPress2.0—my account

The new WP2.0 has been out for more than two weeks now and seeing there haven’t been any urgent patches/bug fixes/etc I assumed it is mature enough to be upgraded. Other than that, it seems like a perfect Sunday procrastination task ;-)

I basically followed the official WP upgrade instructions, but as my WP has been somewhat customized, I had to do some extra steps. Here’s what I did:

  1. Backup the database, disable the plugins (SK2 and Markdown).
  2. Move the old WP directory to blog-old.
  3. Install a new blog directory, fix permissions, copy the configuration files.
  4. Upgrade the blog using upgrade.php script.
  5. Check that everything almost works ;-)

That was easy. Now the difficult part.

First, my theme has been somewhat customized (including Diego’s “linky” patch). However, even if WP2.0 still uses WP1.5 theme, some things have been changed (don’t know exactly what and why). To port my changes, I used the following procedure:

  1. Create a diff against “vanilla” WP1.5.2.
  2. Apply the patch on the new WP2.0.
  3. Fix those little changes that didn’t merge.

Second, I once fixed a bug in WP1.5.2 concerning categories counts on the main page. Basically the problem is that the counts reflect only the “posted” posts and the private posts are not counted. However, when you are logged in and click on a given category you get to see all the posts, also including the private ones. Similarly, (sub)categories containing only private items do not show. The patch for WP1.5.2 was basically a one-liner, but it doesn’t work in WP2.0 :( Looking at the relevant file, it turned out that the new version uses precached counts stored in the database, instead of computing them dynamically. Hence, the patch doesn’t and cannot work. There also doesn’t seem to be an easy way of fixing it, so it has to stay the way it is.

Third, I had to upgrade SpamKarma2.0 to SpamKarma2.1 (I still doesn’t want to use Akismet, which is shipped by default in WP2.0).

Fourth, I upgraded Markdown plugin, to a new verison and disabled the new WYSIWYG editor (seems to conflict with Markdown).

Finally, I made a small fix to “linky” code, as it also conflicts with Markdown plugin. As the linky doce uses wptexturize to get the content of the entry Markdown is not converted correctly. I changed wp_texturixe to apply_filters('the_content',...) as the latter calls the plugin conversion function. However, in this case I had to remove extra p tags, or more precisely, remove all p tags alltogether. Finally the code looks like this:

<li id="p<?php the_ID(); ?>">
    <?php echo preg_replace('{</?[pP]>}', '',apply_filters('the_content',$post->post_content)); echo ' '; comments_popup_link('(0)', '(1)', '(%)')?> <?php edit_post_link('(e)'); ?></li>
</ul>

Actually, this had nothing to do with the upgrade, but it was high time I did it.

Now WP2.0 works well for me. It’s slightly more polished on the editorial side, uses some flashy AJAX stuff and has a new theme. It is probably a bit faster, but other than that looks very much like the old version to me ;-)

UPDATE: My old “press it” bookmarklet stopped working. I generated a new one (from the bottom of “Write Post” page) and… it doesn’t look that cool anymore, but it works.

2 Responses to “Upgrading WordPress1.5.2 to WordPress2.0—my account”

  1. Annie Says:

    This is exactly what I needed. thanks!

  2. Economic and Culture Observer (Lenno Cornish) Says:

    Hmm. How do you think - what is better with WordPress? To download and install new version - or to upgrade currently used one?

Leave a Reply