aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/AppConfig.php5
-rw-r--r--lib/private/Config/UserConfig.php5
-rw-r--r--lib/unstable/Config/Lexicon/ConfigLexiconEntry.php5
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php
index 0eb91fb1be4..ba4bb2a00ce 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -1642,7 +1642,10 @@ class AppConfig implements IAppConfig {
$lazy = $configValue->isLazy();
// only look for default if needed, default from Lexicon got priority
if ($default !== null) {
- $default = $configValue->getDefault($this->getLexiconPreset()) ?? $default;
+ $default = $configValue->getDefault($this->getLexiconPreset(), $saveIt) ?? $default;
+ if ($saveIt ?? false) {
+ $this->setTypedValue($app, $key, $default, $lazy, $type);
+ }
}
if ($configValue->isFlagged(self::FLAG_SENSITIVE)) {
diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php
index fb0bf954f57..0b22cc6f126 100644
--- a/lib/private/Config/UserConfig.php
+++ b/lib/private/Config/UserConfig.php
@@ -1936,7 +1936,10 @@ class UserConfig implements IUserConfig {
// only look for default if needed, default from Lexicon got priority if not overwritten by admin
if ($default !== null) {
- $default = $this->getSystemDefault($app, $configValue) ?? $configValue->getDefault($this->getLexiconPreset()) ?? $default;
+ $default = $this->getSystemDefault($app, $configValue) ?? $configValue->getDefault($this->getLexiconPreset(), $saveIt) ?? $default;
+ if ($saveIt ?? false) {
+ $this->setTypedValue($userId, $app, $key, $default, $lazy, $flags, $type);
+ }
}
// returning false will make get() returning $default and set() not changing value in database
diff --git a/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php b/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php
index 068d89ce764..cb29823dc83 100644
--- a/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php
+++ b/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php
@@ -130,7 +130,7 @@ class ConfigLexiconEntry {
* @return string|null NULL if no default is set
* @experimental 31.0.0
*/
- public function getDefault(Preset $preset): ?string {
+ public function getDefault(Preset $preset, ?bool &$saveIt = null): ?string {
if ($this->default !== null) {
return $this->default;
}
@@ -139,9 +139,10 @@ class ConfigLexiconEntry {
return null;
}
+ $saveIt = false;
if ($this->defaultRaw instanceof Closure) {
/** @psalm-suppress MixedAssignment we expect closure to returns string|int|float|bool|array */
- $this->defaultRaw = ($this->defaultRaw)($preset);
+ $this->defaultRaw = ($this->defaultRaw)($preset, $saveIt);
}
/** @psalm-suppress MixedArgument closure should be managed previously */