WordPress.org

Ready to get started?Download WordPress

Forums

Maintenance Mode Built-In to WordPress? (13 posts)

  1. Tim Nicholson
    Member
    Posted 4 years ago #

    I've searched high and low on this site for any information about the built-in maintenance mode in WordPress. I know there is a plugin called maintenance mode, but I'm trying to get more information about what is already standard in WordPress.

    In the wp-settings.php file, I can see code that looks like it should automatically say your site is in maintenance mode when an upgrade is running. However, both times I've upgraded WordPress and checked the home page of the site, it just hangs until the upgrade is completed.

    I do know PHP pretty well, but I'm not familiar with exactly what all happens behind the scenes in a WordPress upgrade to know what the likely values of all these variables are during the actual upgrade process.

    I would think WP_INSTALLING would only be defined during the initial install not during an upgrade. I don't know what process would place a file called '.maintenance' in the root directory, but it seems reasonable that the upgrade process would do that. Then according to the comments, the ( time() - $upgrading stuff ) logic is there to keep the upgrade from dying after the normal php timeout amount of time. Now that section issues a die() which forces it drop out of the code before that HTML page saying the site is undergoing maintenance ever gets displayed.

    Why wouldn't we actually want to go ahead and display that every time wp-settings.php is called during the upgrade to inform users of the maintenance? It seems according to this code that message would only get displayed if the upgrade takes more than 10 minutes.

    if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
    	include(ABSPATH . '.maintenance');
    	// If the $upgrading timestamp is older than 10 minutes, don't die.
    	if ( ( time() - $upgrading ) < 600 ) {
    		if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
    			require_once( WP_CONTENT_DIR . '/maintenance.php' );
    			die();
    		}
    
    		$protocol = $_SERVER["SERVER_PROTOCOL"];
    		if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
    			$protocol = 'HTTP/1.0';
    		header( "$protocol 503 Service Unavailable", true, 503 );
    		header( 'Content-Type: text/html; charset=utf-8' );
    		header( 'Retry-After: 600' );
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<title>Maintenance</title>
    
    </head>
    <body>
    	<h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
    </body>
    </html>
    <?php
    		die();
    	}
    }
  2. Tim Nicholson
    Member
    Posted 4 years ago #

    Anyone? Anyone? Bueler??

  3. a1wsn
    Member
    Posted 4 years ago #

    See the following page for details of how to activate the built-in maintenance mode :

    http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin/

    It probably doesn't answer your question about why this isn't activating automatically during upgrades, but at least you can see how to activate it manually.

  4. Tim Nicholson
    Member
    Posted 4 years ago #

    a1wsn, thanks for writing articles on this. Very helpful. Any clue as to why this maintenance mode page isn't displayed during an actual WP upgrade?

  5. Tim Nicholson
    Member
    Posted 4 years ago #

    Ok, I've got this all working perfectly in WordPress 3.0 at least. 3.0 DOES display the default maintenance message during an upgrade or mass update of plugins. I've created a maintenance.php file that overrides the default and displays a very nice landing page with a message and social networking links. If anyone wants to check it out, here is a link to my article on how to do it:

    http://xtremelysocial.com/2010/how-to-make-an-awesome-maintenance-mode-screen-for-wordpress/

  6. INCARA
    Member
    Posted 4 years ago #

    I couldnt do it and take all changes back, a blank page show up.

  7. woodygoulart
    Member
    Posted 4 years ago #

    My new 3.0 installation has gotten stuck in maintenance mode and now I cannot turn off maintenance mode nor access my own dashboard. How useful is an automatic maintenance mode if one cannot disable it?

  8. Robert Simpson
    Member
    Posted 4 years ago #

    What Woody said.

  9. LoganSix
    Member
    Posted 4 years ago #

    Add me to the same issue as Woody and RSimpson.

  10. LoganSix
    Member
    Posted 4 years ago #

    Ahhh... apparently it comes back by itself after a while.

    It looks like it was down for about 8 minutes on my site.

  11. Mohd Elfie Nieshaem Juferi
    Member
    Posted 4 years ago #

    Is there a solution to the perpetual "Maintenance Mode" problem in WP 3.0, apart from waiting for it to resolve itself?

  12. José Luís
    Member
    Posted 4 years ago #

    Looks like you should delete (or rename) the file .maintenance located on your blog root dir.

    More info here: http://www.rlmseo.com/blog/briefly-unavailable-for-scheduled-maintenance/

  13. Kevin Leary
    Member
    Posted 3 years ago #

    JLCarneiro's solution worked me, thanks!
    I also managed to create a customized maintenance page that's a little bit better than the default "Briefly unavailable for scheduled maintenance" and also wrote an article that details how to do it:

Topic Closed

This topic has been closed to new replies.

About this Topic