mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
Merge ac6a9be2eb into d09b8c99de
This commit is contained in:
commit
7740d09c10
3 changed files with 12 additions and 4 deletions
|
|
@ -35,6 +35,7 @@ class ConfigLexicon implements ILexicon {
|
|||
defaultRaw: true,
|
||||
definition: 'Whether to not expose the system address book to users',
|
||||
lazy: true,
|
||||
options: Entry::ENFORCE_VALUE_TYPE
|
||||
),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -478,7 +478,9 @@ class AppConfig implements IAppConfig {
|
|||
): string {
|
||||
$this->assertParams($app, $key, valueType: $type);
|
||||
$origKey = $key;
|
||||
$matched = $this->matchAndApplyLexiconDefinition($app, $key, $lazy, $type, $default);
|
||||
/** @var ?Entry $lexiconEntry */
|
||||
$lexiconEntry = null;
|
||||
$matched = $this->matchAndApplyLexiconDefinition($app, $key, $lazy, $type, $default, $lexiconEntry);
|
||||
if ($default === null) {
|
||||
// there is no logical reason for it to be null
|
||||
throw new \Exception('default cannot be null');
|
||||
|
|
@ -501,8 +503,12 @@ class AppConfig implements IAppConfig {
|
|||
&& $knownType > 0
|
||||
&& !$this->isTyped(self::VALUE_MIXED, $knownType)
|
||||
&& !$this->isTyped($type, $knownType)) {
|
||||
$this->logger->warning('conflict with value type from database', ['app' => $app, 'key' => $key, 'type' => $type, 'knownType' => $knownType]);
|
||||
throw new AppConfigTypeConflictException('conflict with value type from database');
|
||||
if ($lexiconEntry?->hasOption(Entry::ENFORCE_VALUE_TYPE)) {
|
||||
$this->updateType($app, $key, $lexiconEntry->getValueType()->toAppConfigFlag());
|
||||
} else {
|
||||
$this->logger->warning('conflict with value type from database', ['app' => $app, 'key' => $key, 'type' => $type, 'knownType' => $knownType]);
|
||||
throw new AppConfigTypeConflictException('conflict with value type from database');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ use OCP\Config\ValueType;
|
|||
class Entry {
|
||||
/** @since 32.0.0 */
|
||||
public const RENAME_INVERT_BOOLEAN = 1;
|
||||
|
||||
/** @since 32.0.0 */
|
||||
public const ENFORCE_VALUE_TYPE = 2;
|
||||
private ?string $default = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue