summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-04 18:50:49 +0200
committerJulius Härtl <jus@bitgrid.net>2018-07-19 08:16:59 +0200
commit14bc9ffda4cdf42b047725b581d6a1129eb70a5b (patch)
treedb66da19c289ccfcdb3d057403ec0ce3cec6a57a /lib
parent59db5250f9b31aced92b88dcfe1024b8a6303d50 (diff)
downloadnextcloud-server-14bc9ffda4cdf42b047725b581d6a1129eb70a5b.tar.gz
nextcloud-server-14bc9ffda4cdf42b047725b581d6a1129eb70a5b.zip
Fixed tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Server.php4
-rw-r--r--lib/private/Template/IconsCacher.php16
-rw-r--r--lib/private/Template/SCSSCacher.php11
3 files changed, 15 insertions, 16 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index c9f8001631e..0f406ebe9b7 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -116,6 +116,7 @@ use OC\Share20\ProviderFactory;
use OC\Share20\ShareHelper;
use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
use OC\Tagging\TagMapper;
+use OC\Template\IconsCacher;
use OC\Template\JSCombiner;
use OC\Template\SCSSCacher;
use OCA\Theming\ImageManager;
@@ -963,7 +964,8 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig(),
$c->getThemingDefaults(),
\OC::$SERVERROOT,
- $this->getMemCacheFactory()
+ $this->getMemCacheFactory(),
+ $c->query(IconsCacher::class)
);
});
$this->registerService(JSCombiner::class, function (Server $c) {
diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php
index c4d073156f1..a8dacfcfbc0 100644
--- a/lib/private/Template/IconsCacher.php
+++ b/lib/private/Template/IconsCacher.php
@@ -26,6 +26,7 @@ namespace OC\Template;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFolder;
+use OCP\Files\SimpleFS\ISimpleFile;
use OCP\ILogger;
use OCP\IURLGenerator;
use OC\Files\AppData\Factory;
@@ -85,10 +86,11 @@ class IconsCacher {
*/
public function setIconsCss(string $css) {
- try {
- $currentData = $this->folder->getFile($this->fileName)->getContent();
- } catch (NotFoundException $e) {
+ $cachedFile = $this->getCachedCSS();
+ if (!$cachedFile) {
$currentData = '';
+ } else {
+ $currentData = $cachedFile->getContent();
}
// remove :root
@@ -102,16 +104,14 @@ class IconsCacher {
}
if (strlen($data) > 0) {
- try {
- $cachedfile = $this->folder->getFile($this->fileName);
- } catch (NotFoundException $e) {
- $cachedfile = $this->folder->newFile($this->fileName);
+ if (!$cachedFile) {
+ $cachedFile = $this->folder->newFile($this->fileName);
}
$data = ":root {
$data
}";
- $cachedfile->putContent($data);
+ $cachedFile->putContent($data);
}
return preg_replace($this->iconVarRE, '', $css);
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index ed1383f8ea3..269daf5556d 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -85,6 +85,7 @@ class SCSSCacher {
* @param \OC_Defaults $defaults
* @param string $serverRoot
* @param ICacheFactory $cacheFactory
+ * @param IconsCacher $iconsCacher
*/
public function __construct(ILogger $logger,
Factory $appDataFactory,
@@ -92,7 +93,8 @@ class SCSSCacher {
IConfig $config,
\OC_Defaults $defaults,
$serverRoot,
- ICacheFactory $cacheFactory) {
+ ICacheFactory $cacheFactory,
+ IconsCacher $iconsCacher) {
$this->logger = $logger;
$this->appData = $appDataFactory->get('css');
$this->urlGenerator = $urlGenerator;
@@ -101,12 +103,7 @@ class SCSSCacher {
$this->serverRoot = $serverRoot;
$this->cacheFactory = $cacheFactory;
$this->depsCache = $cacheFactory->createDistributed('SCSS-' . md5($this->urlGenerator->getBaseUrl()));
-
- $this->iconsCacher = new IconsCacher(
- $this->logger,
- $appDataFactory,
- $this->urlGenerator
- );
+ $this->iconsCacher = $iconsCacher;
}
/**