How might it cause server overloads? Because file.php and send_file() must be called each time a file is requested? Or is it because a value of zero disables byteserving in send_file()?
Setting an arbitrary lifetime for files causes confusion for our editors. Whenever they upload a new copy of a file, then request it to check that everything's gone OK, their changes are not reflected. Needing to hit CTRL+F5 every time they make a change is counter-intuitive when the resource is not already bing displayed in the browser.
I think what you're really after is a way to send a 304 Not Modified header if the file has not changed since the last visit. In this case, $CFG->filelifetime is superfluous.
Here's some additional code for filelib.php that implements this:
$gmtlastmodified = gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT';
header('Last-Modified: '. $gmtlastmodified);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
if (strtotime($gmtlastmodified) <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
header('HTTP/1.0 304 Not Modified');
header('Cache-control: must-revalidate');
exit (0);
}
}
See also the attached patch.
thanks for the report and patch