aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/ThemingDefaults.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/lib/ThemingDefaults.php')
-rw-r--r--apps/theming/lib/ThemingDefaults.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index b7968d0073f..e10870685a5 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -23,6 +23,7 @@
namespace OCA\Theming;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
@@ -38,6 +39,8 @@ class ThemingDefaults extends \OC_Defaults {
private $urlGenerator;
/** @var IRootFolder */
private $rootFolder;
+ /** @var ICacheFactory */
+ private $cacheFactory;
/** @var string */
private $name;
/** @var string */
@@ -60,13 +63,15 @@ class ThemingDefaults extends \OC_Defaults {
IL10N $l,
IURLGenerator $urlGenerator,
\OC_Defaults $defaults,
- IRootFolder $rootFolder
+ IRootFolder $rootFolder,
+ ICacheFactory $cacheFactory
) {
parent::__construct();
$this->config = $config;
$this->l = $l;
$this->urlGenerator = $urlGenerator;
$this->rootFolder = $rootFolder;
+ $this->cacheFactory = $cacheFactory;
$this->name = $defaults->getName();
$this->url = $defaults->getBaseUrl();
@@ -151,14 +156,20 @@ class ThemingDefaults extends \OC_Defaults {
* @return bool
*/
public function shouldReplaceIcons() {
+ $cache = $this->cacheFactory->create('theming');
+ if($cache->hasKey('shouldReplaceIcons')) {
+ return (bool)$cache->get('shouldReplaceIcons');
+ }
+ $value = false;
if(extension_loaded('imagick')) {
$checkImagick = new \Imagick();
if (count($checkImagick->queryFormats('SVG')) >= 1) {
- return true;
+ $value = true;
}
$checkImagick->clear();
}
- return false;
+ $cache->set('shouldReplaceIcons', $value);
+ return $value;
}
/**