summaryrefslogtreecommitdiffstats
path: root/lib/private/Template
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-01-26 17:46:42 +0100
committerJulius Härtl <jus@bitgrid.net>2018-02-03 15:21:51 +0100
commit7381a81d3041a3460617623028d6e8cfb5391649 (patch)
tree5bee0985b80aa30bf7d925cbee589e8da74d19fc /lib/private/Template
parent79e81c15c5beb4174922921083f0e838de9a3bfc (diff)
downloadnextcloud-server-7381a81d3041a3460617623028d6e8cfb5391649.tar.gz
nextcloud-server-7381a81d3041a3460617623028d6e8cfb5391649.zip
Add repair step to clear frontend related caches
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Template')
-rw-r--r--lib/private/Template/JSCombiner.php21
-rw-r--r--lib/private/Template/SCSSCacher.php9
2 files changed, 24 insertions, 6 deletions
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index 6a67dd0dede..b95a59834a6 100644
--- a/lib/private/Template/JSCombiner.php
+++ b/lib/private/Template/JSCombiner.php
@@ -184,9 +184,10 @@ class JSCombiner {
$depFile->putContent($deps);
$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
$gzipFile->putContent(gzencode($res, 9));
-
+ $this->logger->debug('JSCombiner: successfully cached: ' . $fileName);
return true;
} catch (NotPermittedException $e) {
+ $this->logger->error('JSCombiner: unable to cache: ' . $fileName);
return false;
}
}
@@ -227,4 +228,22 @@ class JSCombiner {
return $result;
}
+
+
+ /**
+ * Clear cache with combined javascript files
+ *
+ * @throws NotFoundException
+ */
+ public function resetCache() {
+ $appDirectory = $this->appData->getDirectoryListing();
+ if(empty($appDirectory)){
+ return;
+ }
+ foreach ($appDirectory as $folder) {
+ foreach ($folder->getDirectoryListing() as $file) {
+ $file->delete();
+ }
+ }
+ }
}
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 8830a651f36..eee437eaf62 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -249,9 +249,10 @@ class SCSSCacher {
$depFile->putContent($deps);
$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
$gzipFile->putContent(gzencode($data, 9));
- $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
+ $this->logger->debug('SCSSCacher: '.$webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
return true;
} catch(NotPermittedException $e) {
+ $this->logger->error('SCSSCacher: unable to cache: ' . $fileNameSCSS);
return false;
}
}
@@ -260,7 +261,7 @@ class SCSSCacher {
* Reset scss cache by deleting all generated css files
* We need to regenerate all files when variables change
*/
- private function resetCache() {
+ public function resetCache() {
$this->injectedVariables = null;
$appDirectory = $this->appData->getDirectoryListing();
if(empty($appDirectory)){
@@ -268,9 +269,7 @@ class SCSSCacher {
}
foreach ($appDirectory as $folder) {
foreach ($folder->getDirectoryListing() as $file) {
- if (substr($file->getName(), -3) === 'css' || substr($file->getName(), -4) === 'deps') {
- $file->delete();
- }
+ $file->delete();
}
}
}