]> source.dussan.org Git - nextcloud-server.git/commitdiff
return false on AppConfigUnknownKeyException 43275/head
authorMaxence Lange <maxence@artificial-owl.com>
Thu, 1 Feb 2024 20:48:40 +0000 (19:48 -0100)
committerMaxence Lange <maxence@artificial-owl.com>
Thu, 1 Feb 2024 22:51:17 +0000 (21:51 -0100)
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
lib/private/AppConfig.php

index 8064fe186f83c32f2d031f0391c7711f6cb1158f..07eebf1d047d6864fbfc6d606d0a1b4f1d089db7 100644 (file)
@@ -874,15 +874,18 @@ class AppConfig implements IAppConfig {
         * @param string $key config key
         * @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
         */
        public function updateSensitive(string $app, string $key, bool $sensitive): bool {
                $this->assertParams($app, $key);
                $this->loadConfigAll();
 
-               if ($sensitive === $this->isSensitive($app, $key, null)) {
+               try {
+                       if ($sensitive === $this->isSensitive($app, $key, null)) {
+                               return false;
+                       }
+               } catch (AppConfigUnknownKeyException $e) {
                        return false;
                }
 
@@ -914,15 +917,18 @@ class AppConfig implements IAppConfig {
         * @param string $key config key
         * @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
         */
        public function updateLazy(string $app, string $key, bool $lazy): bool {
                $this->assertParams($app, $key);
                $this->loadConfigAll();
 
-               if ($lazy === $this->isLazy($app, $key)) {
+               try {
+                       if ($lazy === $this->isLazy($app, $key)) {
+                               return false;
+                       }
+               } catch (AppConfigUnknownKeyException $e) {
                        return false;
                }