MDL-26028 use X-Sendfile for theme images and javascript

This commit is contained in:
Petr Skoda
2012-04-29 18:59:08 +02:00
parent d5dd0540c2
commit 7e9f1b63e5
3 changed files with 22 additions and 0 deletions
+8
View File
@@ -99,6 +99,9 @@ if ($rev > -1) {
// parameters to get the best performance.
function send_cached_js($jspath) {
global $CFG;
require("$CFG->dirroot/lib/xsendfilelib.php");
$lifetime = 60*60*24*30; // 30 days
header('Content-Disposition: inline; filename="javascript.php"');
@@ -108,6 +111,11 @@ function send_cached_js($jspath) {
header('Cache-Control: max-age='.$lifetime);
header('Accept-Ranges: none');
header('Content-Type: application/javascript; charset=utf-8');
if (xsendfile($jspath)) {
die;
}
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($jspath));
}