Fix for page_get_cache disable hack

  1. /**
  2.  * Retrieve the current page from the cache.
  3.  *
  4.  * Note: we do not serve cached pages when status messages are waiting (from
  5.  * a redirected form submission which was completed).
  6.  *
  7.  * @param $status_only
  8.  *   When set to TRUE, retrieve the status of the page cache only
  9.  *   (whether it was started in this request or not).
  10.  *
  11.  * @param $return_cache
  12.  *   When set to FALSE, will not return cache.
  13.  */
  14. function page_get_cache($status_only = FALSE, $return_cache = TRUE) {
  15.   static $status = FALSE, $return_cache;
  16.   global $user, $base_root;
  17.  
  18.   if ($status_only) {
  19.     return $status;
  20.   }
  21.   if (!$return_cache) {
  22.     $return_cache = FALSE;
  23.     drupal_set_message("Not caching this page!", "info", FALSE);
  24.   }
  25.   $cache = NULL;
  26.  
  27.   if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_set_message()) == 0 && $return_cache == TRUE) {
  28.     $cache = cache_get($base_root . request_uri(), 'cache_page');
  29.  
  30.     if (empty($cache)) {
  31.       ob_start();
  32.       $status = TRUE;
  33.     }
  34.   }
  35.  
  36.   return $cache;
  37. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.