]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11789, apply $CFG->filelifetime in send_file function.
authordongsheng <dongsheng>
Thu, 7 Aug 2008 06:09:58 +0000 (06:09 +0000)
committerdongsheng <dongsheng>
Thu, 7 Aug 2008 06:09:58 +0000 (06:09 +0000)
lib/filelib.php

index 0600604beb34a8d2cae5783e779e5f2903c7dd24..9d639857e971c00fdb01cd84442f8515f7961d1a 100644 (file)
@@ -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.