Upgrading WordPress the sane way

I finally got around to upgrading the bunch of WordPress blogs that I administer. I do not use the the Debian package, instead each blog is a separate copy, some with customizations. The official instructions make it a pain to upgrade customized WordPresses, so I have used another technique for a while now.

This technique assumes a Unix-style system with all the usual goodies installed and command-line access, as well as Unix competence of the person performing this operation. I leave it to others to write step-by-step instructions for people lacking such competence (feel free to leave a comment).

Step 0: Back up all your WordPress installations!

Step 1: Make sure that you have a copy of the vanilla WordPress directory (unpacked from the zip or tarball and not changed afterward) for the version that you are currently running. I have it (in this case version 2.0.4) as the directory wp-2.0.4.

Step 2: Download the new version, unpack it and rename the unpacked directory to include the version number (in this case, wp-2.0.5).

Step 3: Create a patch file for this upgrade by running diff -Naur wp-2.0.4 wp-2.0.5 > ~/wp-2.0.4-2.0.5.diff.

Step 4: Eyeball the patch to see if it looks sane. (I have on one occasion created a patch that deletes the whole WordPress installation. That is not fun. So check that the diff is sane!)

Step 5: Apply the patch to your WordPress installation by changing to the WordPress installation’s directory and running patch -p1 -i ~/wp-2.0.4-2.0.5.diff.

Step 6: If patch rejected some hunks, eyeball the .rej files to see if you need to manually merge the changes in. This should only happen if you have customized the installation.

Step 7: Run the database upgrade script by going to the admin page and following the instructions.

Step 8: Verify that it all works.

***

It is also possible to manage the installations in darcs or in other version control systems. I haven’t bothered with that yet.

2 thoughts on “Upgrading WordPress the sane way

  1. I assume you are not using the Debian package because of the unique customizations?

    Perhaps wordpress-mu would be better for you? I am thinking of trying it out and perhaps packaging it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>