Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-06-05 17:59:05 +0300
committerJulius Härtl <jus@bitgrid.net>2018-06-06 14:15:52 +0300
commit5b0ce806a3679b34ae3a6f8e6ae32a0b513a4ca9 (patch)
treebdda614353703033cfa26bfd9b8687b2579be3e0 /apps/theming/lib
parentd132527aa9c4baad344b11adef3a6f4a46cde3ab (diff)
Minor fixes and cleanup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Controller/IconController.php4
-rw-r--r--apps/theming/lib/IconBuilder.php9
-rw-r--r--apps/theming/lib/ImageManager.php1
-rw-r--r--apps/theming/lib/Settings/Admin.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php18
5 files changed, 14 insertions, 20 deletions
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php
index 13f385e0bd1..eb01f47dd69 100644
--- a/apps/theming/lib/Controller/IconController.php
+++ b/apps/theming/lib/Controller/IconController.php
@@ -125,7 +125,7 @@ class IconController extends Controller {
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
} catch (NotFoundException $e) {
}
- if ($iconFile === null && $this->themingDefaults->shouldReplaceIcons()) {
+ if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) {
try {
$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app);
} catch (NotFoundException $exception) {
@@ -161,7 +161,7 @@ class IconController extends Controller {
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
} catch (NotFoundException $e) {
}
- if ($this->themingDefaults->shouldReplaceIcons()) {
+ if ($this->imageManager->shouldReplaceIcons()) {
try {
$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app);
} catch (NotFoundException $exception) {
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php
index ad44dd7ed6c..f85e2f9bff8 100644
--- a/apps/theming/lib/IconBuilder.php
+++ b/apps/theming/lib/IconBuilder.php
@@ -35,19 +35,24 @@ class IconBuilder {
private $themingDefaults;
/** @var Util */
private $util;
+ /** @var ImageManager */
+ private $imageManager;
/**
* IconBuilder constructor.
*
* @param ThemingDefaults $themingDefaults
* @param Util $util
+ * @param ImageManager $imageManager
*/
public function __construct(
ThemingDefaults $themingDefaults,
- Util $util
+ Util $util,
+ ImageManager $imageManager
) {
$this->themingDefaults = $themingDefaults;
$this->util = $util;
+ $this->imageManager = $imageManager;
}
/**
@@ -55,7 +60,7 @@ class IconBuilder {
* @return string|false image blob
*/
public function getFavicon($app) {
- if (!$this->themingDefaults->shouldReplaceIcons()) {
+ if (!$this->imageManager->shouldReplaceIcons()) {
return false;
}
try {
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php
index 77afbbe8a87..5d7c11b6e4c 100644
--- a/apps/theming/lib/ImageManager.php
+++ b/apps/theming/lib/ImageManager.php
@@ -181,6 +181,7 @@ class ImageManager {
}
public function delete(string $key) {
+ /* ignore exceptions, since we don't want to fail hard if something goes wrong during cleanup */
try {
$file = $this->appData->getFolder('images')->getFile($key);
$file->delete();
diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php
index 6a95dd39d43..c8d2d561513 100644
--- a/apps/theming/lib/Settings/Admin.php
+++ b/apps/theming/lib/Settings/Admin.php
@@ -81,7 +81,7 @@ class Admin implements ISettings {
'slogan' => $this->themingDefaults->getSlogan(),
'color' => $this->themingDefaults->getColorPrimary(),
'uploadLogoRoute' => $this->urlGenerator->linkToRoute('theming.Theming.uploadImage'),
- 'canThemeIcons' => $this->themingDefaults->shouldReplaceIcons(),
+ 'canThemeIcons' => $this->imageManager->shouldReplaceIcons(),
'iconDocs' => $this->urlGenerator->linkToDocs('admin-theming-icons'),
'images' => $this->imageManager->getCustomImages(),
'imprintUrl' => $this->themingDefaults->getImprintUrl(),
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index a46676a43a9..d29eb69873f 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -317,10 +317,10 @@ class ThemingDefaults extends \OC_Defaults {
$customFavicon = null;
}
- if ($image === 'favicon.ico' && ($customFavicon !== null || $this->shouldReplaceIcons())) {
+ if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue;
}
- if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->shouldReplaceIcons())) {
+ if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue;
}
if ($image === 'manifest.json') {
@@ -334,19 +334,7 @@ class ThemingDefaults extends \OC_Defaults {
}
return false;
}
-
- /**
- * Check if Imagemagick is enabled and if SVG is supported
- * otherwise we can't render custom icons
- *
- * TODO: move to usage of image manager
- *
- * @return bool
- */
- public function shouldReplaceIcons() {
- return $this->imageManager->shouldReplaceIcons();
- }
-
+
/**
* Increases the cache buster key
*/