DrupalBin
Submit Code
About
Recent Posts
Fix for Views cumulus: tag_cloud
Fix for Code
sjfgjgjfgidfgh
Code
Code
test.berniecram.com.alias.drushrc.php
Code
provision-deploy error
Create node programmatically with file
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
Fix for page_get_cache disable hack
View
Fix
June 18, 2008 - 6:06pm — Anonymous
/**
* Retrieve the current page from the cache.
*
* Note: we do not serve cached pages when status messages are waiting (from
* a redirected form submission which was completed).
*
* @param $status_only
* When set to TRUE, retrieve the status of the page cache only
* (whether it was started in this request or not).
*
* @param $return_cache
* When set to FALSE, will not return cache.
*/
function
page_get_cache
(
$status_only
=
FALSE
,
$return_cache
=
TRUE
)
{
static
$status
=
FALSE
,
$return_cache
;
global
$user
,
$base_root
;
if
(
$status_only
)
{
return
$status
;
}
if
(
!
$return_cache
)
{
$return_cache
=
FALSE
;
drupal_set_message
(
"Not caching this page!"
,
"info"
,
FALSE
)
;
}
$cache
=
NULL
;
if
(
!
$user
-
>
uid
&&
$_SERVER
[
'REQUEST_METHOD'
]
==
'GET'
&&
count
(
drupal_set_message
(
)
)
== 0
&&
$return_cache
==
TRUE
)
{
$cache
=
cache_get
(
$base_root
.
request_uri
(
)
,
'cache_page'
)
;
if
(
empty
(
$cache
)
)
{
ob_start
(
)
;
$status
=
TRUE
;
}
}
return
$cache
;
}
disable
hack
page_get_cache
Submit Fix
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
/** * Retrieve the current page from the cache. * * Note: we do not serve cached pages when status messages are waiting (from * a redirected form submission which was completed). * * @param $status_only * When set to TRUE, retrieve the status of the page cache only * (whether it was started in this request or not). * * @param $return_cache * When set to FALSE, will not return cache. */ function page_get_cache($status_only = FALSE, $return_cache = TRUE) { static $status = FALSE, $return_cache; global $user, $base_root; if ($status_only) { return $status; } if (!$return_cache) { $return_cache = FALSE; drupal_set_message("Not caching this page!", "info", FALSE); } $cache = NULL; if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_set_message()) == 0 && $return_cache == TRUE) { $cache = cache_get($base_root . request_uri(), 'cache_page'); if (empty($cache)) { ob_start(); $status = TRUE; } } return $cache; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.