diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AppConfig.php | 29 | ||||
-rw-r--r-- | lib/private/Security/Ip/BruteforceAllowList.php | 5 | ||||
-rw-r--r-- | lib/private/Updater.php | 7 |
3 files changed, 36 insertions, 5 deletions
diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 0eb91fb1be4..f050deba1ca 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -95,8 +95,9 @@ class AppConfig implements IAppConfig { * @inheritDoc * * @param string $app id of the app - * * @return list<string> list of stored config keys + * @see searchKeys to not load lazy config keys + * * @since 29.0.0 */ public function getKeys(string $app): array { @@ -112,6 +113,32 @@ class AppConfig implements IAppConfig { * @inheritDoc * * @param string $app id of the app + * @param string $prefix returns only keys starting with this value + * @param bool $lazy TRUE to search in lazy config keys + * @return list<string> list of stored config keys + * @since 32.0.0 + */ + public function searchKeys(string $app, string $prefix = '', bool $lazy = false): array { + $this->assertParams($app); + $this->loadConfig($app, $lazy); + if ($lazy) { + $keys = array_keys($this->lazyCache[$app] ?? []); + } else { + $keys = array_keys($this->fastCache[$app] ?? []); + } + + if ($prefix !== '') { + $keys = array_filter($keys, static fn (string $key): bool => str_starts_with($key, $prefix)); + } + + sort($keys); + return array_values(array_unique($keys)); + } + + /** + * @inheritDoc + * + * @param string $app id of the app * @param string $key config key * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config * diff --git a/lib/private/Security/Ip/BruteforceAllowList.php b/lib/private/Security/Ip/BruteforceAllowList.php index cc4f0ceebe5..fb837690a7b 100644 --- a/lib/private/Security/Ip/BruteforceAllowList.php +++ b/lib/private/Security/Ip/BruteforceAllowList.php @@ -36,10 +36,7 @@ class BruteforceAllowList { return false; } - $keys = $this->appConfig->getKeys('bruteForce'); - $keys = array_filter($keys, static fn ($key): bool => str_starts_with($key, 'whitelist_')); - - foreach ($keys as $key) { + foreach ($this->appConfig->searchKeys('bruteForce', 'whitelist_') as $key) { $rangeString = $this->appConfig->getValueString('bruteForce', $key); try { $range = $this->factory->rangeFromString($rangeString); diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 6495bad2da2..9cd33863612 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -385,6 +385,13 @@ class Updater extends BasicEmitter { if ($this->installer->isUpdateAvailable($app)) { $this->emit('\OC\Updater', 'upgradeAppStoreApp', [$app]); $this->installer->updateAppstoreApp($app); + } elseif (!empty($previousEnableStates)) { + /** + * When updating a local app we still need to run updateApp + * so that repair steps and migrations are correctly executed + * Ref: https://github.com/nextcloud/server/issues/53985 + */ + \OC_App::updateApp($app); } $this->emit('\OC\Updater', 'checkAppStoreApp', [$app]); |