Make sure the custom favicon is used

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-03-28 12:24:51 +02:00
parent 39f44e1452
commit 7f9dabd984
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 10 additions and 2 deletions

View File

@ -270,10 +270,16 @@ class ThemingDefaults extends \OC_Defaults {
} }
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
if ($image === 'favicon.ico' && $this->shouldReplaceIcons()) { try {
$customFavicon = $this->imageManager->getImage('favicon');
} catch (NotFoundException $e) {
$customFavicon = null;
}
if ($image === 'favicon.ico' && ($customFavicon !== null || $this->shouldReplaceIcons())) {
return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue; return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue;
} }
if ($image === 'favicon-touch.png' && $this->shouldReplaceIcons()) { if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->shouldReplaceIcons())) {
return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue; return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue;
} }
if ($image === 'manifest.json') { if ($image === 'manifest.json') {
@ -318,6 +324,8 @@ class ThemingDefaults extends \OC_Defaults {
$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
$this->cacheFactory->createDistributed('theming-')->clear(); $this->cacheFactory->createDistributed('theming-')->clear();
$this->cacheFactory->createDistributed('imagePath')->clear();
} }
/** /**