diff options
author | rojaro <> | 2011-04-28 10:50:14 +0000 |
---|---|---|
committer | rojaro <> | 2011-04-28 10:50:14 +0000 |
commit | c969d101a7a20bb0fb5c51777616954d9f8fc128 (patch) | |
tree | e70c6cc6b99715e164039639756a86a1e3c93702 | |
parent | 88ae261f20f09d960725d8fbba51b3b98465233f (diff) |
fixed #227
-rw-r--r-- | framework/Web/Javascripts/clientscripts.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/clientscripts.php b/framework/Web/Javascripts/clientscripts.php index 1eed9e42..0d1d6b25 100644 --- a/framework/Web/Javascripts/clientscripts.php +++ b/framework/Web/Javascripts/clientscripts.php @@ -219,13 +219,18 @@ function get_javascript_code($minify=false) /**
* Prints headers to serve javascript
+ *
+ * @param string $filePath (default: NULL)
*/
-function print_headers()
+function print_headers($filePath = false)
{
$expiresOffset = is_debug_mode() ? -10000 : 3600 * 24 * 10; //no cache
header("Content-type: text/javascript");
header("Vary: Accept-Encoding"); // Handle proxies
header("Expires: " . @gmdate("D, d M Y H:i:s", @time() + $expiresOffset) . " GMT");
+ if(null !== $filePath && is_file($filePath)) {
+ header("Last-Modified: " . @gmdate("D, d M Y H:i:s", filectime($filePath)) . " GMT");
+ }
if(($enc = supports_gzip_encoding()) !== null)
header("Content-Encoding: " . $enc);
}
@@ -561,10 +566,8 @@ if(count(get_script_requests()) > 0) {
if(!is_file($filename))
save_javascript(get_javascript_code(true), $filename);
- print_headers();
+ print_headers($filename);
echo get_saved_javascript($filename);
}
}
}
-
-?>
\ No newline at end of file |