How I Fixed My Failed WordPress Upgrade

Today I visited my site to find that it was down…hard. I tried going into the WordPress administrator and was greeted with a message stating that my installation was out of date and that I needed to upgrade. This message was followed by a link to perform the upgrade.

After backing up my database I clicked the ominous link and waited. I didn’t have to wait too long for the upgrade failure message to appear:

WordPress database error: [Unknown column ‘user_nickname’ in ‘field list’]

So I started Googling and found I was far from alone. Great! There must be a solution out there somewhere, I thought. To my surprise, the vast majority of links led to users that had not yet resolved the issue. Luckily I came across a post on remy sharp’s b:log titled How I Fixed WordPress’ Broken Upgrade.

While Remy’s post did not solve the issue I was having, it definitely got me 50% there. The installation is looking for a column named user_nickname in the wp_users table. So, the first step toward correcting the issue was to add that column using the following sql:


alter table wp_users add column user_nickname varchar(250);

Note that, if you’re using custom table prefixes, you’ll need to change the table name so that it matches yours.

After adding the column I ran the upgrade again and the error was gone. Unfortunately, so was any other feedback or content on the page. What I ended up with at this point was a WordPress banner at the top of the page and absolutely nothing below it. Again, Remy’s solution lent a hand.

While Remy’s post directs you to edit wp-admin/upgrade-functions.php, the code has now been moved to wp-admin/includes/upgrade.php. Turns out that the reason a blank page is appearing is because there is a php error. To fix the error, it was necessary to change a line in upgrade.php (or upgrade-functions.php for older versions) from:

$all_options->{$option->option_name} = stripslashes($option->option_value);

to:

if ($option->option_name) $all_options->{$option->option_name} = stripslashes($option->option_value);

The line in question appears around line 795 (654 in upgrade_function.php).

That’s basically where Remy’s issues ended. Unfortunately I wasn’t so lucky because after running the upgrade again I was still presented with the blank screen. It was at this point that my eyes began turning green. Luckily I was able to calm myself down before my shirt began ripping and my skin turned the same color as my eyes.

I pulled up the upgrade.php file again and began scanning through it. That’s when I noticed that the table names in the SQL statements were hard-coded. While this is fine for a default installation, it’s a BIG problem for people who used custom prefixes on their tables.

If you use custom prefixes you’ll need to change all of the SQL statements to reflect your table names. I’m sure this is a variable but I didn’t have the time or inclination to go looking for it. The SQL code can be found from lines 75 through 110.

After fixing the table names I ran the upgrade again with crossed-fingers and….. it failed again. Grrrrrrr…..

This time at least there was an error to research:

Allowed memory size of 8388608 bytes exhausted

To remedy this issue I had to edit wp-admin/upgrade.php. Note that this upgrade.php file is a different file located one directory up from the upgrade.php that you just finished editing (not confusing at all, right?). I was able to fix the memory issue by adding the following line to the top of the page, just inside the opening PHP tag:

ini_set("memory_limit","12M");

I ran it again and, finally, success … kind of.

The upgrade completed with the following message:

WordPress database error: [Table ‘xx_linkcategories’ doesn’t exist]
SELECT cat_id, cat_name FROM wprg_linkcategories
Upgrade Complete

Your WordPress database has been successfully upgraded!

Remy says to ignore the error so I’m choosing to follow his advice at this point since my site is once again up and running.

I hope this helps some of the stranded WP users out that are having the same issue and can’t find help. I also hope that the WordPress developers address this issue in an upcoming release. It seems bizarre to me that it’s existed through multiple versions.

-rG

Be Ready for the Flash Player 9 April 2008 Security Update

Adobe has announced plans to release a security update that could significantly impact existing Flash applications that utilize cross-domain communication.

To quote from their post:

If any of the following situations apply, you should read this article in detail:

* You use sockets or XMLSockets, regardless of the domain to which you are connecting

* You use addRequestHeader or URLRequest.requestHeaders in any network API call when sending or loading data cross-domain
or
You provide access to content on remote domains as a web service provider

* You have SWFs that are exported for Flash Player 7 (SWF7) or earlier that communicate with the hosting HTML by any means

* You use “javascript:” through network APIs to communicate outside a SWF

To defend against malicious HTTP headers, the update requires a cross-domain policy check before allowing SWFs to send headers to another domain.

If you perform any cross-domain communication in your Flash applications, especially those compiled for Flash Player 7 or earlier, you should really take some time to read up on this release.

-rG