aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AppConfig.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/AppConfig.php')
-rw-r--r--lib/private/AppConfig.php29
1 files changed, 28 insertions, 1 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
*