--- includes/bootstrap.inc.1.306 2009-09-21 09:07:07.000000000 +0100 +++ includes/bootstrap.inc 2009-09-30 22:16:34.000000000 +0100 @@ -1438,7 +1438,7 @@ function drupal_get_bootstrap_phase() { function _drupal_bootstrap($phase) { global $conf, $user; - static $cache; + static $cache, $hook_boot_invoked = FALSE; switch ($phase) { @@ -1469,15 +1469,16 @@ function _drupal_bootstrap($phase) { // Make sure there is a user object because it's timestamp will be // checked, hook_boot might check for anonymous user etc. $user = drupal_anonymous_user(); + // If the skipping of the bootstrap hooks is not enforced, call + // hook_boot. + if (variable_get('page_cache_invoke_hooks', TRUE)) { + bootstrap_invoke_all('boot'); + $hook_boot_invoked = TRUE; + } // Get the page from the cache. $cache = drupal_page_get_cache(); // If there is a cached page, display it. if (is_object($cache)) { - // If the skipping of the bootstrap hooks is not enforced, call - // hook_boot. - if (variable_get('page_cache_invoke_hooks', TRUE)) { - bootstrap_invoke_all('boot'); - } header('X-Drupal-Cache: HIT'); drupal_serve_page_from_cache($cache); // If the skipping of the bootstrap hooks is not enforced, call @@ -1521,7 +1522,9 @@ function _drupal_bootstrap($phase) { break; case DRUPAL_BOOTSTRAP_PAGE_HEADER: - bootstrap_invoke_all('boot'); + if (!$hook_boot_invoked) { + bootstrap_invoke_all('boot'); + } if (!$cache && drupal_page_is_cacheable()) { header('X-Drupal-Cache: MISS'); }