summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/clientscripts.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
committerctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
commit0892b27e326f14bd3f6229b55077ef5f9d5280b4 (patch)
tree24039ec47ba8977bf14ba435c058e758e901f185 /framework/Web/Javascripts/clientscripts.php
parent6f00b28a1d9c7409c956a83866eac48a9493e83c (diff)
branch/3.1: merged bugfixes from trunk/ up to current
Diffstat (limited to 'framework/Web/Javascripts/clientscripts.php')
-rw-r--r--framework/Web/Javascripts/clientscripts.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/clientscripts.php b/framework/Web/Javascripts/clientscripts.php
index 1eed9e42..18f4c41b 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 = null)
{
$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