Categories
Site Info Web Development WordPress

Failed WordPress Update

When an update fails on WordPress, sometimes you might just be surprised by how WordPress handles it.
I wasn’t being very smart.

I run far too many WordPress sites. For me, for friends, for my old college fraternity’s 25th anniversary site. Far too many.

They never break on me. The plugins I use are pretty solid and I’ve become a bit lazy. I don’t always follow best practices of backing up everything before updating (though it is all automated anyhow), checking the changelog first, being at a real computer and not just at my phone.

That happened to me the other night. As I was waiting for a train to pass while driving home, I checked a site for an event this weekend on my phone and saw that it had an update. I knew the plugin and knew it would be fine.

I started the update.

But then, a horrible, horrible thing happened. Nothing. Maintenance mode started. The plugin’s update had started, which typically just takes a few seconds. Minutes passed. Nothing.

I opened a new tab. The dreaded scheduled maintenance message.

On a computer, this is no big deal. I’d login via FTP, delete the .maintenance file, and live to fight another day.

But I’m on my phone. Waiting for a train. Why do I do this to myself?

To make matters worse, by the time I got home, I forgot all about it.

The next morning, I turn on the computer and see an unrelated e-mail about the event, again that is coming up this weekend. OH NO I LEFT THE SITE BROKEN OVER NIGHT.

I hit the home page. It worked…

I logged into the site.

This is amazing!
This is amazing!

I’ve honestly never had an update fail like this that I didn’t immediately, as soon as I realized was taking too long, resolve manually.

What’s happening?

When WordPress loads, early on it loads /wp-includes/load.php which fires wp_maintenance() which checks to see if we’re in maintenance mode, which is determined by the presence of a .maintenance file in the root that is created when entering maintenance mode.

Then, it either loads the drop-in wp-content/maintenance.php plugin (for a custom maintenance page) or the default maintenance page unless we’ve been in maintenance mode for more than 10 minutes. In that case, it simply keeps loading WordPress.

I’m not sure why the update failed in the first place, but WordPress handled the failure smarter than I thought it would. Smarter than I was upgrading sites from my phone.

By Brandon Kraft

My life is an open-source book.

Leave a Reply

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