From a17c57b5e3b29d6add4690c1075747f218a3a1a8 Mon Sep 17 00:00:00 2001 From: skodak Date: Fri, 22 Sep 2006 18:08:53 +0000 Subject: [PATCH] Partially reversed patch for http://tracker.moodle.org/browse/MDL-5136, caching of filtered uploaded html files is disabled now MDL-5136 , Eloy is changing the column type in cache_text back to TEXT. --- lib/filelib.php | 2 ++ lib/weblib.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/filelib.php b/lib/filelib.php index eeb2eb3942..c9571ccc90 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -329,7 +329,9 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring= $courseid = SITEID; } if ($mimetype == 'text/html') { + $options = new object(); $options->noclean = true; + $options->nocache = true; // temporary workaround for MDL-5136 $text = $pathisstring ? $path : implode('', file($path)); $output = format_text($text, FORMAT_HTML, $options, $courseid); if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { diff --git a/lib/weblib.php b/lib/weblib.php index f10d32abee..e38296995b 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1263,6 +1263,9 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL if (!isset($options->noclean)) { $options->noclean=false; } + if (!isset($options->nocache)) { + $options->nocache=false; + } if (!isset($options->smiley)) { $options->smiley=true; } @@ -1282,7 +1285,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL } } - if (!empty($CFG->cachetext)) { + if (!empty($CFG->cachetext) and empty($options->nocache)) { $time = time() - $CFG->cachetext; $md5key = md5($text.'-'.$courseid.$options->noclean.$options->smiley.$options->filter.$options->para.$options->newlines.$format.current_language().$courseid.$options->trusttext); if ($oldcacheitem = get_record_sql('SELECT * FROM '.$CFG->prefix.'cache_text WHERE md5key = \''.$md5key.'\'', true)) { -- 2.39.5