From: dongsheng Date: Thu, 7 Aug 2008 06:09:58 +0000 (+0000) Subject: MDL-11789, apply $CFG->filelifetime in send_file function. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c8a5c6a4e02f36cad5e8fd5e97652ce32a3340ac;p=moodle.git MDL-11789, apply $CFG->filelifetime in send_file function. --- diff --git a/lib/filelib.php b/lib/filelib.php index 0600604beb..9d639857e9 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -637,9 +637,18 @@ function send_temp_file_finished($path) { * @param bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin * @param string $mimetype Include to specify the MIME type; leave blank to have it guess the type from $filename */ -function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='') { +function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='') { global $CFG, $COURSE, $SESSION; + // MDL-11789, apply $CFG->filelifetime here + if ($lifetime === 'default') { + if (!empty($CFG->filelifetime)) { + $filetime = $CFG->filelifetime; + } else { + $filetime = 86400; + } + } + session_write_close(); // unlock session during fileserving // Use given MIME type if specified, otherwise guess it using mimeinfo.