Browse Source

return false on AppConfigUnknownKeyException

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/43275/head
Maxence Lange 2 years ago
parent
commit
1b2e503e7f
  1. 14
      lib/private/AppConfig.php

14
lib/private/AppConfig.php

@ -874,17 +874,20 @@ class AppConfig implements IAppConfig {
* @param string $key config key * @param string $key config key
* @param bool $sensitive TRUE to set as sensitive, FALSE to unset * @param bool $sensitive TRUE to set as sensitive, FALSE to unset
* *
* @return bool TRUE if database update were necessary
* @throws AppConfigUnknownKeyException if config key is not known
* @return bool TRUE if entry was found in database and an update was necessary
* @since 29.0.0 * @since 29.0.0
*/ */
public function updateSensitive(string $app, string $key, bool $sensitive): bool { public function updateSensitive(string $app, string $key, bool $sensitive): bool {
$this->assertParams($app, $key); $this->assertParams($app, $key);
$this->loadConfigAll(); $this->loadConfigAll();
try {
if ($sensitive === $this->isSensitive($app, $key, null)) { if ($sensitive === $this->isSensitive($app, $key, null)) {
return false; return false;
} }
} catch (AppConfigUnknownKeyException $e) {
return false;
}
/** /**
* type returned by getValueType() is already cleaned from sensitive flag * type returned by getValueType() is already cleaned from sensitive flag
@ -914,17 +917,20 @@ class AppConfig implements IAppConfig {
* @param string $key config key * @param string $key config key
* @param bool $lazy TRUE to set as lazy loaded, FALSE to unset * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
* *
* @return bool TRUE if database update was necessary
* @throws AppConfigUnknownKeyException if config key is not known
* @return bool TRUE if entry was found in database and an update was necessary
* @since 29.0.0 * @since 29.0.0
*/ */
public function updateLazy(string $app, string $key, bool $lazy): bool { public function updateLazy(string $app, string $key, bool $lazy): bool {
$this->assertParams($app, $key); $this->assertParams($app, $key);
$this->loadConfigAll(); $this->loadConfigAll();
try {
if ($lazy === $this->isLazy($app, $key)) { if ($lazy === $this->isLazy($app, $key)) {
return false; return false;
} }
} catch (AppConfigUnknownKeyException $e) {
return false;
}
$update = $this->connection->getQueryBuilder(); $update = $this->connection->getQueryBuilder();
$update->update('appconfig') $update->update('appconfig')

Loading…
Cancel
Save