summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-30 14:56:19 +0100
committerGitHub <noreply@github.com>2020-11-30 14:56:19 +0100
commitdeb70737242446431fa64a33597678a944e519bd (patch)
tree1d61ec695781ff6410e947a98fccb047e8519e07 /apps
parentbff1f045bb9eceac8b520d867e6bd7d122e91447 (diff)
parent22e26a7f5eebb686ee4d923f4e4fbbd3d8c08b2b (diff)
downloadnextcloud-server-deb70737242446431fa64a33597678a944e519bd.tar.gz
nextcloud-server-deb70737242446431fa64a33597678a944e519bd.zip
Merge pull request #24449 from nextcloud/bugfix/noid/theming-scss-apcu
Store scss variables under a different prefix for each theming config version
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/lib/ThemingDefaults.php5
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php5
2 files changed, 6 insertions, 4 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index f47e4ae294d..242d6866ce1 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -290,13 +290,14 @@ class ThemingDefaults extends \OC_Defaults {
* @return array scss variables to overwrite
*/
public function getScssVariables() {
- $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
+ $cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0');
+ $cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl());
if ($value = $cache->get('getScssVariables')) {
return $value;
}
$variables = [
- 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'",
+ 'theming-cachebuster' => "'" . $cacheBuster . "'",
'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'",
'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'",
'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'",
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index 341a1b24887..e34da50f5a6 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -634,9 +634,10 @@ class ThemingDefaultsTest extends TestCase {
}
public function testGetScssVariablesCached() {
+ $this->config->expects($this->any())->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('1');
$this->cacheFactory->expects($this->once())
->method('createDistributed')
- ->with('theming-')
+ ->with('theming-1-')
->willReturn($this->cache);
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(['foo' => 'bar']);
$this->assertEquals(['foo' => 'bar'], $this->template->getScssVariables());
@@ -658,7 +659,7 @@ class ThemingDefaultsTest extends TestCase {
$this->util->expects($this->any())->method('elementColor')->with($this->defaults->getColorPrimary())->willReturn('#aaaaaa');
$this->cacheFactory->expects($this->once())
->method('createDistributed')
- ->with('theming-')
+ ->with('theming-0-')
->willReturn($this->cache);
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null);
$this->imageManager->expects($this->at(0))->method('getImageUrl')->with('logo')->willReturn('custom-logo?v=0');