Unofficial awesomeness: Awesome Maintenance and error notification

Hello :smiley:

Ever wished you had more errors? No? Of course you don't.

Unfortunately in WordPress these are inevitable. Although very, very, very stable... you do need to update WordPress and the plugins/themes quite often, especially with the recent exposed vulnerabilities.
And when you do, your users and visitors will see an error message.

Or what about migration of your database, or with the awesome Multi-DB plugin it might so occur that one of your servers go offline, this leaves a "error establishing a database connection" message for your user.
And you aren't informed about this!

Or the user has recently deleted his blog, why not inform your users that they can undo this.. or better yet: leave a message to where they can sign up!

Or you've marked a blog as spam.. unfortunately. With Anti-Splog this message will be created for you. But what if you don't use Anti-Splog?

I can elaborate much more... but it all comes down to this:
I'm a good webmaster and I want to look professional.

So what do you do? You brand that stuff!
Just look at the awesome screenshots below :smiley:

Now you can do that too, for free :smiley:

WordPress has some awesome stuff built into its core, dig deeper: https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/load.php#L0
https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/ms-load.php#L0

Here you'll see the error messages for when your site is updating plugins or themes.
You can overwrite these!

They're called:

  1. blog-deleted.php - For when a user deletes his blog
  2. blog-inactive.php - For when a user hasn't activated his blog
  3. blog-suspended.php - For when a blog has been marked as spam
  4. db-error.php - For when hell breaks loose (or a database connection failed)
  5. maintenance.php - For when you update your WPcore/themes/plugins

What I've done for you:
I created these files beforehand, with the right error codes and messages.
I also set up a nice countdown script for when your user encounters the update message and an auto-reload in the header (15 seconds).
I also set up a lovely error handling script for you in db-error.php, read more below.

blog-deleted.php
I can't say much about this, it speaks for itself. This only occurs when a non-super-admin deletes his or her blog.

blog-inactive.php
The blog hasn't been activated yet after the signup process.

blog-suspended.php
WPMUdev's Anti-Splog has already created this for you if you use it. Leave it alone if you use Anti-Splog and don't overwrite it.
However, if you don't use Anti-Splog, this will page can be safely uploaded and will tell the user his/her blog has been marked as spam.

maintenance.php
A lovely way to tell your users you're undergoing updates/maintenance. It will also refresh the page (and thus redirect them to where they wanted to go) within 15 seconds. They could also spam the big blue button to do so (or hold F5).
This will also throw a 503 error to tell Google to not index the page and retry in 10 minutes.

db-error.php
Now this is something I loved working on. Pure PHP without WordPress goodies.
This page tells the users that there has been an error connecting to your database. Especially useful if you use WPMUdev's awesome, yes AWESOME, Multi-DB plugin where you split your databases (and errors are more likely if you use VIP or multiple servers).
This file will also create a logfile in /wp-content/dberror/ AND send you a mail whenever this happens (max once daily).
It will also throw a 503 error and tell Google to retry in 1 hour.

503 errors are also useful if you use an uptime checker like Pingdom or CA.

All files contain basic styling (got from the login page) and basic text.
Be sure to update these texts according to your site's needs. This isn't a plugin so I can't call those from your database.
Also update the e-mail address in db-error.php

The download:
https://cyberwire.nl/share/AwesomeMaintenance.zip

Usage:

  1. Edit the files to your liking.
  2. Open FTP and connect to your server. Go to /wp-content/
  3. Check if blog-suspended.php is already there.. if so you might use WPMUdev's AntiSplog
  4. If you use AntiSplog, it's better kept untouched
  5. Upload the rest of the files :slight_smile:. And blog-suspended too if you don't use Anti-Splog.

How to test it for looks?

  1. Simply open any site of yours in the network
  2. Go to: example.com/wp-content/db-error.php
  3. Check your e-mail inbox to see if you got the mail :slight_smile:, if not.. change the e-mail in the file
  4. Go to: example.com/wp-content/maintenance.php
  5. Go to: example.com/wp-content/blog-deleted.php
  6. Go to: example.com/wp-content/blog-inactive.php
  7. Go to: example.com/wp-content/blog-suspended.php
  8. All looks good? Good.

Screenshots below of how they look (in Dutch) :slight_smile: The first one is my login page, from which I took the styling. I'll upload an equivalent look for that later on for you to style :slight_smile:

But I don't use Multisite....
That's OK! db-error.php and maintenance.php are still useful :smiley:

Comments? Suggestions? Leave them below :smiley: