aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-05-11 20:33:49 +0200
committerBart Visscher <bartv@thisnet.nl>2012-05-11 21:33:02 +0200
commit919681f3e6a075f45c667bef0f9b44a4db0a37f1 (patch)
tree0bf7170c3786f90aaa7c7007d046d9067a268e78 /lib/base.php
parent847832ae77938597dca1d0fb9c41366d568a70ef (diff)
downloadnextcloud-server-919681f3e6a075f45c667bef0f9b44a4db0a37f1.tar.gz
nextcloud-server-919681f3e6a075f45c667bef0f9b44a4db0a37f1.zip
Make processed css files cachable
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 7d073481e00..f54ddae48ca 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -288,10 +288,15 @@ class OC{
if(substr(OC::$REQUESTEDFILE, -3) == 'css'){
$appswebroot = (string) OC::$APPSWEBROOT;
$webroot = (string) OC::$WEBROOT;
- $cssfile = file_get_contents(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE);
+ $filepath = OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
+ $cssfile = file_get_contents($filepath);
$cssfile = str_replace('%appswebroot%', $appswebroot, $cssfile);
$cssfile = str_replace('%webroot%', $webroot, $cssfile);
header('Content-Type: text/css');
+ OC_Response::enableCaching();
+ OC_Response::setLastModifiedHeader(filemtime($filepath));
+ OC_Response::setETagHeader(md5($cssfile));
+ header('Content-Length: '.strlen($cssfile));
echo $cssfile;
exit;
}elseif(substr(OC::$REQUESTEDFILE, -3) == 'php'){