summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-03-20 12:31:29 +0100
committerJulius Härtl <jus@bitgrid.net>2017-03-20 14:12:35 +0100
commit29ec58f1b5099e49539a85f734a6c8192ce295b4 (patch)
tree1d2122c67ee3f8a8a153a9e6dff1939f1b966418 /lib/private
parentccd35095d05cfcb4e436efd8360147628198b4e1 (diff)
downloadnextcloud-server-29ec58f1b5099e49539a85f734a6c8192ce295b4.tar.gz
nextcloud-server-29ec58f1b5099e49539a85f734a6c8192ce295b4.zip
Add tests for SCSSCacher
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Template/SCSSCacher.php27
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 3aa649da65a..4f5c66f2409 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -28,6 +28,7 @@ use Leafo\ScssPhp\Formatter\Expanded;
use OC\SystemConfig;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\ILogger;
@@ -93,7 +94,7 @@ class SCSSCacher {
$folder = $this->appData->newFolder($app);
}
- if($this->isCached($fileNameCSS, $fileNameSCSS, $folder, $path) && !$this->variablesChanged($fileNameCSS, $folder)) {
+ if($this->isCached($fileNameCSS, $fileNameSCSS, $folder, $path)) {
return true;
}
return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
@@ -124,28 +125,6 @@ class SCSSCacher {
} catch(NotFoundException $e) {
return false;
}
- return false;
- }
-
- /**
- * Check if the variables file has changed
- * @param string $fileNameCSS
- * @param ISimpleFolder $folder
- * @return bool
- */
- private function variablesChanged($fileNameCSS, ISimpleFolder $folder) {
- $variablesFile = \OC::$SERVERROOT . '/core/css/variables.scss';
- try {
- $cachedFile = $folder->getFile($fileNameCSS);
- if ($cachedFile->getMTime() < filemtime($variablesFile)
- || $cachedFile->getSize() === 0
- ) {
- return true;
- }
- } catch (NotFoundException $e) {
- return true;
- }
- return false;
}
/**
@@ -200,7 +179,7 @@ class SCSSCacher {
$depFile->putContent(json_encode($scss->getParsedFiles()));
$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
return true;
- } catch(NotFoundException $e) {
+ } catch(NotPermittedException $e) {
return false;
}
}