Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.116
diff -u -F^f -r1.116 bootstrap.inc
--- includes/bootstrap.inc	25 Aug 2006 05:42:00 -0000	1.116
+++ includes/bootstrap.inc	27 Aug 2006 17:14:36 -0000
@@ -10,7 +10,8 @@
 define('CACHE_TEMPORARY', -1);
 
 define('CACHE_DISABLED', 0);
-define('CACHE_ENABLED', 1);
+define('CACHE_STANDARD', 1);
+define('CACHE_AGGRESSIVE', 2);
 
 define('WATCHDOG_NOTICE', 0);
 define('WATCHDOG_WARNING', 1);
@@ -382,11 +383,6 @@ function drupal_load($type, $name) {
 /**
  * Set HTTP headers in preparation for a page response.
  *
- * The general approach here is that anonymous users can keep a local
- * cache of the page, but must revalidate it on every request.  Then,
- * they are given a '304 Not Modified' response as long as they stay
- * logged out and the page has not been modified.
- *
  * Authenticated users are always given a 'no-cache' header, and will
  * fetch a fresh page on every request.  This prevents authenticated
  * users seeing locally cached pages that show them as logged out.
@@ -395,65 +391,87 @@ function drupal_load($type, $name) {
  */
 function drupal_page_header() {
   if (variable_get('cache', 0) && $cache = page_get_cache()) {
+    drupal_page_cache_header($cache);
+  }
+  else {
+    header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
+    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+    header("Cache-Control: no-store, no-cache, must-revalidate");
+    header("Cache-Control: post-check=0, pre-check=0", FALSE);
+    header("Pragma: no-cache");
+  }
+}
+
+/**
+ * Set HTTP headers in preparation for a cached page response.
+ *
+ * The general approach here is that anonymous users can keep a local
+ * cache of the page, but must revalidate it on every request.  Then,
+ * they are given a '304 Not Modified' response as long as they stay
+ * logged out and the page has not been modified.
+ *
+ * If the cache level is set to CACHE_AGGRESSIVE, then the bootstrap init 
+ * and exit hooks will not be called and module will not be loaded.
+ */
+function drupal_page_cache_header($cache) {
+  if (variable_get('cache', 0) != CACHE_AGGRESSIVE) {
     bootstrap_invoke_all('init');
-    // Set default values:
-    $date = gmdate('D, d M Y H:i:s', $cache->created) .' GMT';
-    $etag = '"'. md5($date) .'"';
-
-    // Check HTTP headers:
-    $modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $date : NULL;
-    if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($timestamp = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) > 0) {
-      $modified_since = $cache->created <= $timestamp;
-    }
-    else {
-      $modified_since = NULL;
-    }
-    $none_match = !empty($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : NULL;
+  }
 
-    // The type checking here is very important, be careful when changing entries.
-    if (($modified_since !== NULL || $none_match !== NULL) && $modified_since !== FALSE && $none_match !== FALSE) {
-      header('HTTP/1.1 304 Not Modified');
-      // All 304 responses must send an etag if the 200 response for the same object contained an etag
-      header("Etag: $etag");
-      exit();
-    }
+  // Set default values:
+  $date = gmdate('D, d M Y H:i:s', $cache->created) .' GMT';
+  $etag = '"'. md5($date) .'"';
+
+  // Check HTTP headers:
+  $modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $date : NULL;
+  if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($timestamp = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) > 0) {
+    $modified_since = $cache->created <= $timestamp;
+  }
+  else {
+    $modified_since = NULL;
+  }
+  $none_match = !empty($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : NULL;
 
-    // Send appropriate response:
-    header("Last-Modified: $date");
-    header("ETag: $etag");
+  // The type checking here is very important, be careful when changing entries.
+  if (($modified_since !== NULL || $none_match !== NULL) && $modified_since !== FALSE && $none_match !== FALSE) {
+    header('HTTP/1.1 304 Not Modified');
+    // All 304 responses must send an etag if the 200 response for the same object contained an etag
+    header("Etag: $etag");
+    exit();
+  }
 
-    // The following headers force validation of cache:
-    header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
-    header("Cache-Control: must-revalidate");
+  // Send appropriate response:
+  header("Last-Modified: $date");
+  header("ETag: $etag");
 
-    // Determine if the browser accepts gzipped data.
-    if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) {
-      // Strip the gzip header and run uncompress.
-      $cache->data = gzinflate(substr(substr($cache->data, 10), 0, -8));
-    }
-    elseif (function_exists('gzencode')) {
-      header('Content-Encoding: gzip');
-    }
+  // The following headers force validation of cache:
+  header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
+  header("Cache-Control: must-revalidate");
 
-    // Send the original request's headers. We send them one after
-    // another so PHP's header() function can deal with duplicate
-    // headers.
-    $headers = explode("\n", $cache->headers);
-    foreach ($headers as $header) {
-      header($header);
-    }
+  // Determine if the browser accepts gzipped data.
+  if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) {
+    // Strip the gzip header and run uncompress.
+    $cache->data = gzinflate(substr(substr($cache->data, 10), 0, -8));
+  }
+  elseif (function_exists('gzencode')) {
+    header('Content-Encoding: gzip');
+  }
 
-    print $cache->data;
-    bootstrap_invoke_all('exit');
-    exit();
+  // Send the original request's headers. We send them one after
+  // another so PHP's header() function can deal with duplicate
+  // headers.
+  $headers = explode("\n", $cache->headers);
+  foreach ($headers as $header) {
+    header($header);
   }
-  else {
-    header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
-    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-    header("Cache-Control: no-store, no-cache, must-revalidate");
-    header("Cache-Control: post-check=0, pre-check=0", FALSE);
-    header("Pragma: no-cache");
+
+  print $cache->data;
+
+  if (variable_get('cache', 0) != CACHE_AGGRESSIVE) {
+    bootstrap_invoke_all('exit');
   }
+
+  exit();
 }
 
 /**
@@ -665,14 +683,19 @@ function _drupal_bootstrap($phase) {
     case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
       if (variable_get('page_cache_fastpath', 0)) {
         require_once variable_get('cache_inc', './includes/cache.inc');
-        page_cache_fastpath();
-        exit;
+        if (page_cache_fastpath()) {
+          exit;
+        }
       }
       break;
     case DRUPAL_BOOTSTRAP_DATABASE:
       // Initialize the default database.
       require_once './includes/database.inc';
       db_set_active();
+      if (variable_get('cache', CACHE_DISABLED) == CACHE_AGGRESSIVE) {
+        require_once variable_get('cache_inc', './includes/cache.inc');
+        drupal_page_header();
+      }
       break;
 
     case DRUPAL_BOOTSTRAP_SESSION:
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.350
diff -u -F^f -r1.350 system.module
--- modules/system/system.module	25 Aug 2006 15:17:47 -0000	1.350
+++ modules/system/system.module	27 Aug 2006 17:14:39 -0000
@@ -590,8 +590,8 @@ function system_page_caching_settings() 
     '#type' => 'radios',
     '#title' => t('Page cache'),
     '#default_value' => variable_get('cache', CACHE_DISABLED),
-    '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
-    '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
+    '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_STANDARD => t('Standard'), CACHE_AGGRESSIVE => t('Aggressive')),
+    '#description' => t("In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages requested by \"anonymous\" users. By caching a web page, Drupal does not have to create the page each time someone wants to view it. The 'standard' cache option is suitable for most sites without any side effects. 'Aggressive' caching is twice as fast since it skips the loading of enabled modules when serving a cached page. For most modules this is not a problem, however some modules such as statistics and throttle modules will lose a part of their functionality since they track information regarding anonymous user visits and are now no longer able to do so.  Other contributed and custom modules may also be affected.")
   );
 
   $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
