Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,17 @@ public function searchKeys(string $app, string $prefix = '', bool $lazy = false)
public function hasKey(string $app, string $key, ?bool $lazy = false): bool {
$this->assertParams($app, $key);
$this->loadConfig($app, $lazy ?? true);
$this->matchAndApplyLexiconDefinition($app, $key);
$lexiconEntry = null;
$this->matchAndApplyLexiconDefinition($app, $key, lexiconEntry: $lexiconEntry);

if (!$lazy && $lexiconEntry?->isLazy() === true) {
// using updateLazy() will load lazy cache but also fix the lazy
// flag in the database if needed. Still Light if no changes are needed
$lazy = true;
if ($this->updateLazy($app, $key, true)) {
$this->loadConfig($app, true);
}
}

$hasLazy = isset($this->lazyCache[$app][$key]);
$hasFast = isset($this->fastCache[$app][$key]);
Expand Down Expand Up @@ -229,13 +239,13 @@ public function isLazy(string $app, string $key): bool {
$this->assertParams($app, $key);
$this->matchAndApplyLexiconDefinition($app, $key);

// there is a huge probability the non-lazy config are already loaded
if ($this->hasKey($app, $key, false)) {
$this->loadConfig($app, false);
if (isset($this->fastCache[$app][$key])) {
return false;
}

// key not found, we search in the lazy config
if ($this->hasKey($app, $key, true)) {
$this->loadConfig($app, true);
if (isset($this->lazyCache[$app][$key])) {
return true;
}

Expand Down Expand Up @@ -1811,13 +1821,14 @@ private function matchAndApplyLexiconDefinition(
return $this->applyLexiconStrictness($configDetails['strictness'], $app . '/' . $key);
}

/** @var Entry $lexiconEntry */
$lexiconEntry = $configDetails['entries'][$key];

// if lazy is NULL, we ignore all check on the type/lazyness/default from Lexicon
if ($lazy === null) {
return true;
}

/** @var Entry $lexiconEntry */
$lexiconEntry = $configDetails['entries'][$key];
$type &= ~self::VALUE_SENSITIVE;

$appConfigValueType = $lexiconEntry->getValueType()->toAppConfigFlag();
Expand Down
Loading