Recent Topics

1 Mar 21, 2009 05:37    

currently if you change $maintenance_mode in /conf/_basic_config.php from 0 to 1 it kills all access to the blog. Even your feed goes dead. What I would really like to see is some sort of advancement there. For example if you make it be 1 it should kill all access except for ID#1 accessing the back office. Change it to 2 and all registered users can get to the back office. In both cases the feed shouldn't look like your web is dead because really it isn't dead - it is in maintenance mode. So for example it replaces the real feed with a "post" that has 'doing maintenance' as the title and (of course) no content.

I've been using it a bit lately and being totally locked out has some drawbacks eh? Like, I can pretty much deal with it but it'd be way cool if ID#1 could still get in to the admin side of town ... and especially not make the feed look like you went offline.

Cuz clearly if you're doing maintenance you're not gone is the thing. And some maintenance is easier with the back office live.

2 Mar 21, 2009 07:29

As a temporarily solution you can put something like this in conf/hacks.php

global $current_User;

if( !is_logged_in() || (is_logged_in() && $current_User->ID != 1) )
{
	header('HTTP/1.0 503 Service Unavailable');
	echo '<h1>503 Service Unavailable</h1>';
	die( 'The site is temporarily down for maintenance.' );
}

You're right about the core feature, and there also should be different ways to display the debug info only to selected users/groups, or at least to user #1

3 Mar 21, 2009 20:48

Awesome! I tweaked it a wee bit so I could leave it there until the next time I need it. Fairly simple tweak, as I'm sure you already guessed given that it's code from me eh?

// this is "maintenance mode for everyone but me"
if( false ) {
	global $current_User;
	if( !is_logged_in() || (is_logged_in() && $current_User->ID != 1) ) {
		header('HTTP/1.0 503 Service Unavailable');
		echo '<h1>503 Service Unavailable</h1>';
		die( 'The site is temporarily down for maintenance.' );
		}
	}

Now all I gotta do next time is change the false to true and it'll be like magic.

Thanks sam2kb!


Form is loading...