diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-08 20:48:57 -0500 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-09 21:43:09 -0500 |
commit | d83c8e02718f5ae555e75d8582904611a4d6766a (patch) | |
tree | 67fb7e75cff7023ac5765804b2fbf441c0a9cf1e | |
parent | 5b4adf66e51e21b3ecbd683397a362b60f792a50 (diff) | |
download | nextcloud-server-d83c8e02718f5ae555e75d8582904611a4d6766a.tar.gz nextcloud-server-d83c8e02718f5ae555e75d8582904611a4d6766a.zip |
ThemingDefaults append cacheBusterCounter to logo URL by default
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 15 | ||||
-rw-r--r-- | apps/theming/tests/ThemingDefaultsTest.php | 18 |
2 files changed, 18 insertions, 15 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index d4dc56d3ba9..073410da2c3 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -138,11 +138,13 @@ class ThemingDefaults extends \OC_Defaults { $logoExists = false; } + $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); + if(!$logo || !$logoExists) { - return $this->urlGenerator->imagePath('core','logo.svg'); + return $this->urlGenerator->imagePath('core','logo.svg') . '?v=' . $cacheBusterCounter; } - return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); + return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter; } /** @@ -191,15 +193,6 @@ class ThemingDefaults extends \OC_Defaults { } /** - * Gets the current cache buster count - * - * @return string - */ - public function getCacheBusterCounter() { - return $this->config->getAppValue('theming', 'cachebuster', '0'); - } - - /** * Increases the cache buster key */ private function increaseCacheBuster() { diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 986b2f34267..ad8f86f1c13 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -417,25 +417,35 @@ class ThemingDefaultsTest extends TestCase { public function testGetLogoDefault() { $this->config - ->expects($this->once()) + ->expects($this->at(0)) ->method('getAppValue') ->with('theming', 'logoMime') ->willReturn(''); + $this->config + ->expects($this->at(1)) + ->method('getAppValue') + ->with('theming', 'cachebuster', '0') + ->willReturn('0'); $this->appData ->expects($this->once()) ->method('getFolder') ->with('images') ->willThrowException(new \Exception()); - $expected = $this->urlGenerator->imagePath('core','logo.svg'); + $expected = $this->urlGenerator->imagePath('core','logo.svg') . '?v=0'; $this->assertEquals($expected, $this->template->getLogo()); } public function testGetLogoCustom() { $this->config - ->expects($this->once()) + ->expects($this->at(0)) ->method('getAppValue') ->with('theming', 'logoMime') ->willReturn('image/svg+xml'); + $this->config + ->expects($this->at(1)) + ->method('getAppValue') + ->with('theming', 'cachebuster', '0') + ->willReturn('0'); $simpleFolder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) @@ -447,7 +457,7 @@ class ThemingDefaultsTest extends TestCase { ->method('getFile') ->with('logo') ->willReturn(''); - $expected = $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); + $expected = $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=0'; $this->assertEquals($expected, $this->template->getLogo()); } } |