summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/bootstrap.inc14
-rw-r--r--includes/common.inc2
2 files changed, 10 insertions, 6 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 41dca93ce..320ca3ac7 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -321,8 +321,6 @@ function variable_del($name) {
*
* Note: we do not serve cached pages when status messages are waiting (from
* a redirected form submission which was completed).
- * Because the output handler is not activated, the resulting page will not
- * get cached either.
*/
function page_get_cache() {
global $user, $base_root;
@@ -585,15 +583,21 @@ function drupal_set_message($message = NULL, $type = 'status') {
*
* @param $type
* (optional) Only return messages of this type.
+ * @param $clear_queue
+ * (optional) Set to FALSE if you do not want to clear the messages queue
*/
-function drupal_get_messages($type = NULL) {
+function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
if ($messages = drupal_set_message()) {
if ($type) {
- unset($_SESSION['messages'][$type]);
+ if ($clear_queue) {
+ unset($_SESSION['messages'][$type]);
+ }
return array($type => $messages[$type]);
}
else {
- unset($_SESSION['messages']);
+ if ($clear_queue) {
+ unset($_SESSION['messages']);
+ }
return $messages;
}
}
diff --git a/includes/common.inc b/includes/common.inc
index c4d17485f..234c8d94e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1586,7 +1586,7 @@ function _drupal_bootstrap_full() {
function page_set_cache() {
global $user, $base_root;
- if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET') {
+ if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_get_messages(NULL, FALSE)) == 0) {
// This will fail in some cases, see page_get_cache() for the explanation.
if ($data = ob_get_contents()) {
$cache = TRUE;