Strap in and brace yourself, because this could get boring very quickly.
Keen-eyed regular readers will have noticed the unavailablility of this site for a few days and wondered whether it was the latest victim of Anonymous or Lulzsec or a Tory conspiracy. Nothing so exciting: just technical problems. I won’t describe the problems in painful detail, but I might get tedious in describing the fix.The first I noticed that anything was wrong was that I kept getting an error message about not finding the database – a serious matter when you consider that a WordPress blog is basically just one big database. I remembered getting some emails from the hosting company about moving servers to Utah and used Occam’s Razor to put two and two together.
I logged a call and, sure enough, they found that a setting was wrong and had put it right. Unfortunately this just led to a different error – the page you get when you are installing WordPress. A quick look behind the scenes in phpMyAdmin showed that the database had no tables and was taking up no space. So an empty database, which is why any admin functions redirected to the install command, assuming it was a new site.
I pointed this out to tech support and they confirmed that something must have gone wrong during the move and came up with several options. Unfortunately they then found that the database on the old server was corrupted somehow so re-migrating stopped being an option. This corruption might also explain why the database didn’t transfer I guess.
It was a bit of a worry when they asked me if I had any backups. I have been a bit slack with backing up the database, but was pleasantly surprised to find a backup as recent as about a month ago. It would mean losing a month’s worth of posts and comments, but I have been slack at posting recently as well, so not as bad as it could have been.
The old backup was imported and I was set to go. The first problem was that I couldn’t log in, which upset me for a moment until I remembered that I had very recently changed the admin login to make everything more secure, and the database backup was done before that, so I just had to login with the old account name and password.
With that first scare out of the way, the next thing was that WordPress told me the database was inthe wrong format and needed to be converted. WTF? Then I remembered the reason why I did the backup – it was prior to upgrading WordPress so was still in the format of the previous version. That seemed fair enough, so I let WordPress upgrade the database.
At this point everything looked fine, except for missing all the content for a month. I was actually able to recover most of it by going through Google and finding cached versions of everything. Nearly everything anyway. It seems that Google doesn’t keep cached pages forever and one post was just too old to be there.
I figured that I had done well to get back all the posts except one, and then on a whim decided to try a different search engine. I had a look at Bing and straight away got a cached copy of the missing post. I must remember to stop mentally writing off Bing because in this case it has proved superior to Google.
If I wanted to get really anal about it all I could probably have got enough details of comments and put a lot of them back manually, but that would have taken a long time, so I didn’t.
To make up for being slack with backups I decided to be thorough about the recovery. I left a dummy index page up to stop anybody else accessing the site while I checked everything out.
One thing I did was deactivate the plugins that update Facebook and Twitter when a new post is published. I didn’t want to flood anybody’s timelines with a loads of updates about old posts being republished manually. When I reactivated them I found that the Facebook one wouldn’t connect properly.
There was an error message about a possible conflict with another plugin which isn’t updated for changed to Facebook’s API. I wasted a lot of time deactivating and reactivating plugins to try and track down the clash, even though I couldn’t see how any of the other plugins would use the Facebook API except possibly Sociable. At this point I looked at the Wordbook plugin’s website and found hundreds of comments from other people complaining of exactly the same thing since upgrading WordPress, so it wasn’t anything to do with my own disaster recovery.
Before making the site live again, I made a fresh backup of the database. No point making mistakes if you are not going to learn from them! I now have a nice new backup in the right format, and with all the right admin account details. Not only that, but I have set up a scheduled backup to run weekly.
Everything looks OK now except for one annoying thing. I have noticed that lots (most?) old posts and pages have the character Â all over the place. I haven’t studied it to establish a pattern beyond doubt, but it looks like the Â is always cropping up before a double space. I like to put a double space after a full stop, so it is nearly always after a full stop, but I think it is the double space which is more significant.
I guess I could edit everyone of nearly 4000 posts manually and delete any Â I find. That sounds like a lot of hard work. The other option might be to try a find & replace command in SQL to delete it, or to replace “Â ” with ” “. That sounds more elegant, but scares the crap out of me.
I have done some find & replace on the database before without any ill effects but it could all go horribly wrong if the command is not exactly right. Obviously I would do a backup first, but even so… If nothing else it would make this post look stup because it has lots of deliberate Âs that would disappear.
A good candidate for the back burner I think.
Looking at the database structure a bit behind the scenes, I noticed that a lot of the tables are in a Swedish format/character set and I wonder if that is related. The thing is I never looked beforehand. Perhaps it has always been like that.
Think I’ll try to not worry about it for now. More of a worry is that everything seems terribly slow since the move, something I’ll have to keep an eye on, but do let me know if you have trouble: it is all evidence I can use to get tech support to look into it.