MDL-11789, apply $CFG->filelifetime in send_file function.

This commit is contained in:
dongsheng
2008-08-07 06:09:58 +00:00
parent b6558c3b0c
commit c8a5c6a4e0
+10 -1
View 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.