WordPress upgrade

About a week ago I upgraded my WordPress installation. Before I forget how it went I want to describe it here.

I had not upgraded WordPress for some time. I had 2.7.2 or something. At that moment there was 2.8.3. I always try out the upgrade on a local copy of the site on my laptop. I have some non-trivial stuff, for example a theme that hasn’t been updated for quite some time, so that may become incompatible with the new version. Also I use the gengo plugin to make the blog multilingual. Gengo has a lot of hooks in WordPress, so it can be quite fragile with upgrades. Also gengo hasn’t been updated since wordpress 2.6.2. There are also several outstanding bugs, some of which I have corrected in my private copy. The developers seem to have disappeared, fallen asleep or busy with other things. My guess is the latter. Because of the use of gengo I has to tweak my theme also a bit. All in all this can make upgrading WordPress quite an adventure.

I tried to do everything according to the book: make a backup of the database first. (The software isn’t such a problem because it is identical to the remote website. The database isn’t identical because you can’t just take a dump of one WordPress database and install it somewhere else.) Then deactivate all the plugins which by the way I had upgraded before the dump. Then replace the wordpress files with the new versions, but keeping the themes, languages and plugins that you already had. I find this actually a tedious way of doing. I wished WordPress would separate the thing that you install yourself from its own installation so that you could just replace the whole WordPress software tree.

There were two errors after the upgrade. The first was immediate: the theme crashed. It appears to be this line in tiga.php:

$cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");

The $order variable is not defined so the whole orderby part can be removed:

$cats = get_categories("type=link&order=$direction&hierarchical=0");

However, this is caused by a bug in the new WordPress version.

The second problem appeared when I activated all the plugins. Gengo caused an infinite redirection. Gengo rewrites URLs to append the language name (if you choose that option). This rewriting went into an endless loop. Fortunately this appeared to be a known problem. The solution is to set the permalink structure again in the WordPress management panel Unfortunately this also couldn’t be reached because of the endless redirection. So I had to manually remove the gengo plugin from the site first. Then I had two windows open in the browser:  one with the plugins and one with the permalink options. Activate gengo in the first one and then save the permalink structure in the other one.

After that I just did the whole operation in the real site (this one), but I forgot to deactivate the plugins first. And the endless redirection problem did not appear.

So far so good. Now WordPress 2.8.4 appeared with a security update. I am looking into upgrading again. Moreover I discovered that my theme is no longer localized with the language of the post as it was previously. With the upgrade to 2.8.3 I had apparently overlooked this. I don’t really know what has changed in WordPress to cause this, but I saw that l10n.php which does the localisation has some changes between 2.6.1 and 2.8.3. I looked into the `locale’ filter in gengo.php and found this suspicious piece of code:

if (isset($this->processed_locale)) return $locale;
 $this->processed_locale = true;

I don’t know what it is, but it looks like a kind of caching the locale. When I commented that code the localisation was back. So it solves the problem, but I really don’t know what I am doing here.

I will be going to look for an alternative to gengo, however. What I like about gengo is that it keeps translated posts as separate posts and ties them together through the database. This means that if you deactivate gengo your posts will still function although you will now see all of them. There are other multilingual plugins that put the different languages of a multilingual post in the same entry with special language tags to separate them. This means that if you deactivate them for some reason you get a lot of garbage in your posts and you have to split them up. I just don’t like that.

But now first to 2.8.4