]> git.mjollnir.org Git - moodle.git/commitdiff
Added latest knowledge on caching techniques to HEAD
authormoodler <moodler>
Fri, 10 Dec 2004 06:20:54 +0000 (06:20 +0000)
committermoodler <moodler>
Fri, 10 Dec 2004 06:20:54 +0000 (06:20 +0000)
lib/weblib.php

index 0c05a1b065d883b46d571fb22e9bb4c710ce74be..b845c7e96865324a18ea60e650cd59d84e4a7d52 100644 (file)
@@ -1565,16 +1565,21 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta=
         $direction = ' dir="ltr"';
     }
 
-    if (!$cache) {   // Do everything we can to prevent clients and proxies caching
-        @header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
-        @header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+    if ($cache) {  // Allow caching on "back" (but not on normal clicks)
+        @header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
+        @header('Pragma: no-cache');
+        @header('Expires: ');          
+    } else {       // Do everything we can to always prevent clients and proxies caching
         @header('Cache-Control: no-store, no-cache, must-revalidate');
         @header('Cache-Control: post-check=0, pre-check=0', false);
         @header('Pragma: no-cache');
+        @header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
+        @header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
 
-        $meta .= "\n".'<meta http-equiv="pragma" content="no-cache" />';
-        $meta .= "\n".'<meta http-equiv="expires" content="0" />';
+        $meta .= "\n<meta http-equiv=\"pragma\" content=\"no-cache\" />";
+        $meta .= "\n<meta http-equiv=\"expires\" content=\"0\" />";
     }
+    @header('Accept-Ranges: none');
 
     if ($usexml) {       // Added by Gustav Delius / Mad Alex for MathML output
                          // Modified by Julian Sedding