MDL-28709 adding HTTP_IF_MODIFIED_SINCE and minor style tweaks
This commit is contained in:
@@ -49,11 +49,11 @@ if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
|
||||
$candidate = "$CFG->dataroot/cache/theme/$themename/javascript_$type.js";
|
||||
|
||||
if ($rev > -1 and file_exists($candidate)) {
|
||||
if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) {
|
||||
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
// we do not actually need to verify the etag value because our files
|
||||
// never change in cache because we increment the rev parameter
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
$lifetime = 60*60*24*30; // 30 days
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
|
||||
header('Cache-Control: max-age='.$lifetime);
|
||||
header('Content-Type: application/javascript; charset=utf-8');
|
||||
|
||||
Reference in New Issue
Block a user