diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index d7d5954..129fafe 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1063,6 +1063,7 @@ function drupal_page_get_cache($check_only = FALSE) { */ function drupal_page_is_cacheable($allow_caching = NULL) { $allow_caching_static = &drupal_static(__FUNCTION__, TRUE); + if (isset($allow_caching)) { $allow_caching_static = $allow_caching; } @@ -2396,6 +2397,7 @@ function _drupal_bootstrap_page_cache() { drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); $cache_enabled = variable_get('cache'); } + drupal_block_denied(ip_address()); // If there is no session cookie and cache is enabled (or forced), try // to serve a cached page. @@ -2405,26 +2407,34 @@ function _drupal_bootstrap_page_cache() { $user = drupal_anonymous_user(); // Get the page from the cache. $cache = drupal_page_get_cache(); + // If there is a cached page, display it. if (is_object($cache)) { - header('X-Drupal-Cache: HIT'); - // Restore the metadata cached with the page. - $_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 (variable_get('page_cache_invoke_hooks', TRUE)) { - bootstrap_invoke_all('exit'); + + // Check to see if hook_boot decided this page should not be cached + if (drupal_page_is_cacheable()) { + header('X-Drupal-Cache: HIT'); + // Restore the metadata cached with the page. + $_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. + drupal_serve_page_from_cache($cache); + // If the skipping of the bootstrap hooks is not enforced, call + // hook_exit. + if (variable_get('page_cache_invoke_hooks', TRUE)) { + bootstrap_invoke_all('exit'); + } + // We are done. + exit; + } + else { + header('X-Drupal-Cache: MISS'); } - // We are done. - exit; } else { header('X-Drupal-Cache: MISS');