From 66e5f959e9c537ebff15b534be4b46974e0e0c07 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 1 Apr 2004 02:32:04 +0000 Subject: [PATCH] Can now handle a $CFG->filelifetime to determine cacheability of files --- file.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/file.php b/file.php index 3d236cb764..37d6d8bb5c 100644 --- a/file.php +++ b/file.php @@ -5,7 +5,9 @@ require_once("config.php"); require_once("files/mimetypes.php"); - $lifetime = 86400; + if (empty($CFG->filelifetime)) { + $CFG->filelifetime = 86400; /// Seconds for files to remain in caches + } if (isset($file)) { // workaround for situations where / syntax doesn't work $pathinfo = $file; @@ -46,8 +48,8 @@ $mimetype = mimeinfo("type", $filename); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT"); - header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT"); - header("Cache-control: max_age = $lifetime"); // a day + header("Expires: " . gmdate("D, d M Y H:i:s", time() + $CFG->filelifetime) . " GMT"); + header("Cache-control: max_age = $CFG->filelifetime"); header("Pragma: "); header("Content-disposition: inline; filename=$filename"); header("Content-length: ".filesize($pathname)); -- 2.39.5