diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index b6c531c..e822b4f 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -2401,6 +2401,10 @@ function _drupal_bootstrap_page_cache() { // Make sure there is a user object because its timestamp will be // checked, hook_boot might check for anonymous user etc. $user = drupal_anonymous_user(); + // If skipping the bootstrap hooks is not enforced, invoke hook_boot(). + if (variable_get('page_cache_invoke_hooks', TRUE)) { + bootstrap_invoke_all('boot'); + } // Get the page from the cache. $cache = drupal_page_get_cache(); // If there is a cached page, display it. @@ -2410,14 +2414,8 @@ function _drupal_bootstrap_page_cache() { $_GET['q'] = $cache->data['path']; drupal_set_title($cache->data['title'], PASS_THROUGH); date_default_timezone_set(drupal_get_user_timezone()); - // 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'); - } drupal_serve_page_from_cache($cache); - // If the skipping of the bootstrap hooks is not enforced, call - // hook_exit. + // If skipping the bootstrap hooks is not enforced, invoke hook_exit(). if (variable_get('page_cache_invoke_hooks', TRUE)) { bootstrap_invoke_all('exit'); } @@ -2428,6 +2426,10 @@ function _drupal_bootstrap_page_cache() { header('X-Drupal-Cache: MISS'); } } + else { + // Invoke hook_boot(). + bootstrap_invoke_all('boot'); + } } /** @@ -2500,11 +2502,9 @@ function _drupal_bootstrap_variables() { } /** - * Invokes hook_boot(), initializes locking system, and sends HTTP headers. + * Send HTTP headers. */ function _drupal_bootstrap_page_header() { - bootstrap_invoke_all('boot'); - if (!drupal_is_cli()) { ob_start(); drupal_page_header();