aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-04 09:59:32 +0100
committerMorris Jobke <hey@morrisjobke.de>2020-11-09 10:01:34 +0100
commitc7ff0c71b4d7d78e1da6901ef6820eea70dfa82a (patch)
treef3d16ef512c2a7ffa00396d1c12fd97ae5784c0c /apps/theming/lib
parent0247f22c837d515458b0c1d3a34d904ce8001930 (diff)
downloadnextcloud-server-c7ff0c71b4d7d78e1da6901ef6820eea70dfa82a.tar.gz
nextcloud-server-c7ff0c71b4d7d78e1da6901ef6820eea70dfa82a.zip
Shortcut to avoid file system setup when generating the logo URL
If an SVG is requested and the app config value for logoMime is set then the logo is there. Otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which needs to be called then). Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/ThemingDefaults.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 3f0a94e244a..01af4d1b177 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -225,11 +225,20 @@ class ThemingDefaults extends \OC_Defaults {
public function getLogo($useSvg = true): string {
$logo = $this->config->getAppValue('theming', 'logoMime', false);
- $logoExists = true;
- try {
- $this->imageManager->getImage('logo', $useSvg);
- } catch (\Exception $e) {
- $logoExists = false;
+ // short cut to avoid setting up the filesystem just to check if the logo is there
+ //
+ // explanation: if an SVG is requested and the app config value for logoMime is set then the logo is there.
+ // otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which
+ // needs to be called then)
+ if ($useSvg === true && $logo !== false) {
+ $logoExists = true;
+ } else {
+ try {
+ $this->imageManager->getImage('logo', $useSvg);
+ $logoExists = true;
+ } catch (\Exception $e) {
+ $logoExists = false;
+ }
}
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');