(Sorry if I have tagged this to the wrong component -- not sure if it should be in admin module or base system)

I was doing quite a few major changes to my site recently, and realised that it would be a good idea to take the site offline while I was at work ... but there was no simple way of doing it. Mambo has this feature, and I would find it very useful in Drupal.

When I posted the idea in the forum (see http://drupal.org/node/15751#comment-26045), it was suggested that I could achieve this affect by editing my .htaccess file, and restoring the original once I wanted the site on-line again.

Howver, hacking .htaccess seems a bit crude, and it's not really the sort of solution I was hoping for. I would not want non-technical administrators to even think of trying it, and I don't like generating 404 errors or simply redirecting everything to the home page -- it would look like the site was broken.

It would be nice if there was some simple way of disabling all access for particular categories of user. A login page would obviously still have to be available (at http://www.mysite.dom?q=user/login ), but otherwise users would be presented with a simple message saying "this site is temporarily off-line for maintenance. Please try again later"

Tweaks could allow for customisable off-line messages, and ideally for an optional time-constraint on the "offline" mode -- in case the admin forgets to turn it back on again.

Comments

chrisada’s picture

Isn't permission settings enouch? If you disable 'access content' for all user roles, the site is pretty much sealed. Then in admin/setting you can set a custom page to show for '403 access denied', and say whatever you want there.

clairem’s picture

Thanks chrisada

That sounded like it's part way towards what I'm looking for. But when I tried it out (see below) it turns out to be way too complicated, and doesn't achieve all I wanted.

Here are the steps I took:

  1. go to admin/users/configure/permissions
  2. scroll down the list of modules to find node->access content
  3. make a note of which categories of user have content access, because when restoring, I don't want to assume that all categories were enabled
  4. carefully disable 'access content' for each of six user roles, taking care not to inadvertently alter the settings for "administer nodes" (the "administer" and "access" buttons are a mere five pixels apart on most themes)
  5. Realising that for safety's sake, I should have made a note of "administer nodes" priveliges as well, I press back button to cancel the page, then reload it again
  6. Note administer nodes priveliges
  7. again, carefully disable 'access content' for each of six user roles, then press save
  8. go to admin/settings, and scroll down to find settings for 403 errors
  9. See it needs a new page, so load extra browser window and create a simple, crude page saying site "21st Jan, 1pm. Offline for a few hours for maintenance. Pls come back later"
  10. Enter new page number as node/xx in the settings page, and save

I this point I wanted to test it ... but just in case I'd screwed something up, I didn't want to log out in case I couldn't get back in again. So I fired up another browser, and went to take a look.

The results were not very encouraging:

  1. Template still displayed as usual, as I expected.
  2. Content area just shows "access denied": no sign of my "offline" message.
  3. Reload page, etc -- no better. (When I think about this, it makes sense; if access to content is denied, it can't display a node)
  4. Test the menu, and primary links: find that most things are indeed "access denied"
  5. Try a search, and find that it still throws up a list of hits ... and remember that I didn't disable "search for content" :(

So this doesn't really do what I want.

I'd like a "take site offline" function which had all that functionality available on one dedicated page on the admin menu, without having to burrow around more generalised pages.

Having it spread over several pages makes it more likely that users would would forget to turn something back on properly. Since those pages have other settings on them too, there's a risk of making an error and altering another setting.

This seems to me to be something that's a sufficiently important function to justify grouping it all together. And it would be particularly nice to have the ability to enable this function for selected user categories on admin/user/configure/permission

kbahey’s picture

Perhaps a scheme that combines the use of the front_page module (http://drupal.org/node/13367) and a custom 404 page that points to front_page?

To elaborate, if the front_page module is configured with a a non-themed customer page (which just has HTML saying 'our web site is under maintenance, and will be back in 2 hours'.

Hmm. That would not work still. Requests to valid nodes will still get the nodes, not the web site down message.

OK, another idea: if there is a flag parameter that bootstrap can check for, and if set it goes to a configurable node path, that would do the trick. Care should be taken to allow the admin to login still (otherwise one would lock himself out).

Any other ideas?

kbahey’s picture

Status: Active » Closed (duplicate)

This is now a 4.7 feature.