]> git.mjollnir.org Git - moodle.git/commitdiff
The text caching is now sensitive on the temporary variable
authormoodler <moodler>
Tue, 10 Feb 2004 09:59:46 +0000 (09:59 +0000)
committermoodler <moodler>
Tue, 10 Feb 2004 09:59:46 +0000 (09:59 +0000)
   $CFG->currenttextiscacheable

Any filter can set this to FALSE and the current text will not be cached

lib/weblib.php

index 31f230d0f8ba7b610e62570717e05911034227d8..3f3bf9c67e0aaea1bfe30fa1656a1df2a2e5fab6 100644 (file)
@@ -500,11 +500,13 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
     }
 
     if (empty($courseid)) {
-        if (!empty($course->id)) {     // An ugly hack for better compatibility
+        if (!empty($course->id)) {         // An ugly hack for better compatibility
             $courseid = $course->id;
         }
     }
 
+    $CFG->currenttextiscacheable = true;   // Default status - can be changed by any filter
+
     switch ($format) {
         case FORMAT_HTML:
             replace_smilies($text);
@@ -535,7 +537,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
             break;
     }
 
-    if (!empty($CFG->cachetext)) {
+    if (!empty($CFG->cachetext) and $CFG->currenttextiscacheable) {
         $newrecord->md5key = $md5key;
         $newrecord->formattedtext = addslashes($text);
         $newrecord->timemodified = time();