Hy,

i want to ser the site in maintenance mode BUT allow still some pages. Can i easely add some "allowed" pages to a list and done?

Comments

Jaypan’s picture

This functionality does not appear in core. There may be a contributed module that allows for this, but I've never seen one myself. Searching the modules (http://www.drupal.org/project/modules) is probably your best bet, if such a module exists.

I will soon be leaving the Drupal forums permanently. To understand why, please see this thread.

agualog’s picture

For anyone wondering, you can alter the access to pages in maintenance mode.

From user.module, line ~1800 :

<?php
   
if (user_is_anonymous()) {
      switch (
$path) {
        case
'user':
         
// Forward anonymous user to login page.
         
drupal_goto('user/login');
         
        case
'foo/bar':
        case
'user/login':
        case
'user/password':
         
// Disable offline mode.
         
$menu_site_status = MENU_SITE_ONLINE;
          break;
        default:
          if (
strpos($path, 'user/reset/') === 0) {
           
// Disable offline mode.
           
$menu_site_status = MENU_SITE_ONLINE;
          }
          break;
      }
    }
?>

Trying to add "foo/bar", and it worked like a charm. This is a hook of hook_menu_site_status_alter(), passing site status by reference allowing you to dynamically alter access to some pages in maintenance mode.

Writing your own quick module could do the trick in few lines :)

Quick example :

<?php
function mymodule_menu_site_status_alter(&$menu_site_status, $path) {
  if (
$menu_site_status == MENU_SITE_OFFLINE) {
if (
$path == 'foo/bar') $menu_site_status = MENU_SITE_ONLINE;
}
?>