]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make processed css files cachable
authorBart Visscher <bartv@thisnet.nl>
Fri, 11 May 2012 18:33:49 +0000 (20:33 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 11 May 2012 19:33:02 +0000 (21:33 +0200)
lib/base.php

index 7d073481e00cb4817cadf3177b2bc2c077125190..f54ddae48ca781e04c146efe21f966bd0044adaf 100644 (file)
@@ -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'){