Categories
Computers Development WTF

Nightmare on Elm^H^H^HWordPress upgrade…

I just had a nightmarish experience when I upgraded Debian’s unstable WordPress package to version 2.1. When I invoked my site for the first time, WordPress prompted me to upgrade its database — which I did, of course, or rather “I tried to do.”

After I started the upgrade, I saw a dozen or so error messages rushing over my screen. When I analyzed them, I quickly recognized that the database user didn’t have sufficient permissions to perform certain table alterations. I thought, “Hey, no prob, correct the permission problems, and re-run everything.”

But “Not so!” WordPress was able to write the new WP database version no. into the database in the last step of the upgrade procedure, so the upgrade refused to run again because it thought the database was already current.

So what could I do?

I searched thru the database to find the database version no., and manually changed it back from 4772 to 4351. When I visited my blog again, WordPress prompted me again to upgrade, and this time it worked!!! Hurray!!!

So, what is the lesson of this? Guys, pleeeease, for the sake of clean programming, be defensive in that you prefer too many return code checks over too few.

It is really bad practice to simply assume an operation was successful, instead of making sure it was successful. If an operation fails that is the prerequisite of another, you must stop in case the prerequisite operation could not successfully be performed.

I wish that my words be heard by the WordPress guys, but I doubt that they are reading my lousy blog… 😉

Anyway, if you are a programmer and read this, do yourself and the users of your software a favor and remember the advice of someone who has been developing computer software since about 25 years now.

By Ralf Bergs

Geek, computer guy, licensed and certified electrical and computer engineer, husband, best daddy.