|
|
|
@ -1,9 +1,12 @@ |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
declare(strict_types=1); |
|
|
|
|
/** |
|
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
|
|
|
* |
|
|
|
|
* @author Bart Visscher <bartv@thisnet.nl> |
|
|
|
|
* @author Joas Schilling <coding@schilljs.com> |
|
|
|
|
* @author Maxence Lange <maxence@artificial-owl.com> |
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de> |
|
|
|
|
* @author Robin Appelman <robin@icewind.nl> |
|
|
|
|
* @author Robin McCorkell <robin@mccorkell.me.uk> |
|
|
|
@ -26,28 +29,537 @@ |
|
|
|
|
*/ |
|
|
|
|
namespace OCP; |
|
|
|
|
|
|
|
|
|
use OCP\Exceptions\AppConfigUnknownKeyException; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This class provides an easy way for apps to store config values in the |
|
|
|
|
* database. |
|
|
|
|
* |
|
|
|
|
* **Note:** since 29.0.0, it supports **lazy loading** |
|
|
|
|
* |
|
|
|
|
* ### What is lazy loading ? |
|
|
|
|
* |
|
|
|
|
* By default, app config values are all loaded in memory; but in order to avoid |
|
|
|
|
* loading useless config values in memory on each request on the cloud, it has |
|
|
|
|
* been made possible to set your config keys as lazy. |
|
|
|
|
* When set as lazy, the values will only be loaded in memory when needed. |
|
|
|
|
* In fact, the cloud will load all config set as lazy loaded when a first one |
|
|
|
|
* is requested. |
|
|
|
|
* |
|
|
|
|
* It is advised to set a config key as lazy when its value is only needed during |
|
|
|
|
* really specific request, in part of code that is not called frequently. |
|
|
|
|
* |
|
|
|
|
* **Note:** some methods from this class are marked with a warning about ignoring |
|
|
|
|
* lazy filtering, meaning it will load in memory all apps config values. use them |
|
|
|
|
* wisely and only in part of code called during specific request/action. |
|
|
|
|
* |
|
|
|
|
* @since 29.0.0 supports lazy loading |
|
|
|
|
* @since 7.0.0 |
|
|
|
|
*/ |
|
|
|
|
interface IAppConfig { |
|
|
|
|
public const VALUE_SENSITIVE = 1; |
|
|
|
|
public const VALUE_MIXED = 2; |
|
|
|
|
public const VALUE_STRING = 4; |
|
|
|
|
public const VALUE_INT = 8; |
|
|
|
|
public const VALUE_FLOAT = 16; |
|
|
|
|
public const VALUE_BOOL = 32; |
|
|
|
|
public const VALUE_ARRAY = 64; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* check if a key is set in the appconfig |
|
|
|
|
* @param string $app |
|
|
|
|
* @param string $key |
|
|
|
|
* @return bool |
|
|
|
|
* Get list of all apps that have at least one config value stored in database |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @return string[] list of app ids |
|
|
|
|
* @since 7.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function getApps(): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns all keys stored in database, related to an app. |
|
|
|
|
* Please note that the values are not returned. |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* |
|
|
|
|
* @return string[] list of stored config keys |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function getKeys(string $app): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Check if a key exists in the list of stored config values. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if key exists |
|
|
|
|
* @since 29.0.0 Added the $lazy argument |
|
|
|
|
* @since 7.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function hasKey($app, $key); |
|
|
|
|
public function hasKey(string $app, string $key, ?bool $lazy = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* best way to see if a value is set as sensitive (not displayed in report) |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool|null $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value is sensitive |
|
|
|
|
* @throws AppConfigUnknownKeyException if config key is not known |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function isSensitive(string $app, string $key, ?bool $lazy = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns if the config key stored in database is lazy loaded |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if config is lazy loaded |
|
|
|
|
* @throws AppConfigUnknownKeyException if config key is not known |
|
|
|
|
* @see IAppConfig for details about lazy loading |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function isLazy(string $app, string $key): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List all config values from an app with config key starting with $key. |
|
|
|
|
* Returns an array with config key as key, stored value as value. |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config keys prefix to search, can be empty. |
|
|
|
|
* @param bool $filtered filter sensitive config values |
|
|
|
|
* |
|
|
|
|
* @return array<string, string> [configKey => configValue] |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function getAllValues(string $app, string $key = '', bool $filtered = false): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List all apps storing a specific config key and its stored value. |
|
|
|
|
* Returns an array with appId as key, stored value as value. |
|
|
|
|
* |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return array<string, string> [appId => configValue] |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function searchValues(string $key, bool $lazy = false): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param string $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return string stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueInt() |
|
|
|
|
* @see getValueBigInt() |
|
|
|
|
* @see getValueFloat() |
|
|
|
|
* @see getValueBool() |
|
|
|
|
* @see getValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function getValueString(string $app, string $key, string $default = '', bool $lazy = false): string; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param int $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return int stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueString() |
|
|
|
|
* @see getValueBigInt() |
|
|
|
|
* @see getValueFloat() |
|
|
|
|
* @see getValueBool() |
|
|
|
|
* @see getValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param int|float $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return int|float stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueString() |
|
|
|
|
* @see getValueInt() |
|
|
|
|
* @see getValueFloat() |
|
|
|
|
* @see getValueBool() |
|
|
|
|
* @see getValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function getValueBigInt(string $app, string $key, int|float $default = 0, bool $lazy = false): int|float; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param float $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return float stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueString() |
|
|
|
|
* @see getValueInt() |
|
|
|
|
* @see getValueBigInt() |
|
|
|
|
* @see getValueBool() |
|
|
|
|
* @see getValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return bool stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueString() |
|
|
|
|
* @see getValueInt() |
|
|
|
|
* @see getValueBigInt() |
|
|
|
|
* @see getValueFloat() |
|
|
|
|
* @see getValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get config value assigned to a config key. |
|
|
|
|
* If config key is not found in database, default value is returned. |
|
|
|
|
* If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param array $default default value |
|
|
|
|
* @param bool $lazy search within lazy loaded config |
|
|
|
|
* |
|
|
|
|
* @return array stored config value or $default if not set in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy loading |
|
|
|
|
* @see getValueString() |
|
|
|
|
* @see getValueInt() |
|
|
|
|
* @see getValueBigInt() |
|
|
|
|
* @see getValueFloat() |
|
|
|
|
* @see getValueBool() |
|
|
|
|
*/ |
|
|
|
|
public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* returns the type of config value |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* |
|
|
|
|
* @return int |
|
|
|
|
* @throws AppConfigUnknownKeyException |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see VALUE_STRING |
|
|
|
|
* @see VALUE_INT |
|
|
|
|
* @see VALUE_FLOAT |
|
|
|
|
* @see VALUE_BOOL |
|
|
|
|
* @see VALUE_ARRAY |
|
|
|
|
*/ |
|
|
|
|
public function getValueType(string $app, string $key): int; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param string $value config value |
|
|
|
|
* @param bool $sensitive if TRUE value will be hidden when listing config values. |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueInt() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueFloat() |
|
|
|
|
* @see setValueBool() |
|
|
|
|
* @see setValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function setValueString(string $app, string $key, string $value, bool $lazy = false, bool $sensitive = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param int $value config value |
|
|
|
|
* @param bool $sensitive if TRUE value will be hidden when listing config values. |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueString() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueFloat() |
|
|
|
|
* @see setValueBool() |
|
|
|
|
* @see setValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function setValueInt(string $app, string $key, int $value, bool $lazy = false, bool $sensitive = false): bool; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param int|float $value config value |
|
|
|
|
* @param bool $sensitive if TRUE value will be hidden when listing config values. |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueString() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueFloat() |
|
|
|
|
* @see setValueBool() |
|
|
|
|
* @see setValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function setValueBigInt(string $app, string $key, int|float $value, bool $lazy = false, bool $sensitive = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param float $value config value |
|
|
|
|
* @param bool $sensitive if TRUE value will be hidden when listing config values. |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueString() |
|
|
|
|
* @see setValueInt() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueBool() |
|
|
|
|
* @see setValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function setValueFloat(string $app, string $key, float $value, bool $lazy = false, bool $sensitive = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool $value config value |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueString() |
|
|
|
|
* @see setValueInt() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueFloat() |
|
|
|
|
* @see setValueArray() |
|
|
|
|
*/ |
|
|
|
|
public function setValueBool(string $app, string $key, bool $value, bool $lazy = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Store a config key and its value in database |
|
|
|
|
* |
|
|
|
|
* If config key is already known with the exact same config value, the database is not updated. |
|
|
|
|
* If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded. |
|
|
|
|
* |
|
|
|
|
* If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param array $value config value |
|
|
|
|
* @param bool $sensitive if TRUE value will be hidden when listing config values. |
|
|
|
|
* @param bool $lazy set config as lazy loaded |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if value was different, therefor updated in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
* @see IAppConfig for explanation about lazy grouping |
|
|
|
|
* @see setValueString() |
|
|
|
|
* @see setValueInt() |
|
|
|
|
* @see setValueBigInt() |
|
|
|
|
* @see setValueFloat() |
|
|
|
|
* @see setValueBool() |
|
|
|
|
*/ |
|
|
|
|
public function setValueArray(string $app, string $key, array $value, bool $lazy = false, bool $sensitive = false): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* switch sensitive status of a config value |
|
|
|
|
* |
|
|
|
|
* **WARNING:** ignore lazy filtering, all config values are loaded from database |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @param bool $sensitive TRUE to set as sensitive, FALSE to unset |
|
|
|
|
* |
|
|
|
|
* @return bool TRUE if database update were necessary |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function updateSensitive(string $app, string $key, bool $sensitive): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* switch lazy loading status of a config value |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @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 |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function updateLazy(string $app, string $key, bool $lazy): bool; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* returns an array contains details about a config value |
|
|
|
|
* |
|
|
|
|
* ``` |
|
|
|
|
* [ |
|
|
|
|
* "app" => "myapp", |
|
|
|
|
* "key" => "mykey", |
|
|
|
|
* "value" => "its_value", |
|
|
|
|
* "lazy" => false, |
|
|
|
|
* "type" => 4, |
|
|
|
|
* "typeString" => "string", |
|
|
|
|
* 'sensitive' => true |
|
|
|
|
* ] |
|
|
|
|
* ``` |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
* @throws AppConfigUnknownKeyException if config key is not known in database |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function getDetails(string $app, string $key): array; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Convert string like 'string', 'integer', 'float', 'bool' or 'array' to |
|
|
|
|
* to bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT}, |
|
|
|
|
* {@see VALUE_BOOL} and {@see VALUE_ARRAY} |
|
|
|
|
* |
|
|
|
|
* @param string $type |
|
|
|
|
* |
|
|
|
|
* @return int |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function convertTypeToInt(string $type): int; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Convert bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT}, |
|
|
|
|
* {@see VALUE_BOOL} and {@see VALUE_ARRAY} to human-readable string |
|
|
|
|
* |
|
|
|
|
* @param int $type |
|
|
|
|
* |
|
|
|
|
* @return string |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function convertTypeToString(int $type): string; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Delete single config key from database. |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @param string $key config key |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function deleteKey(string $app, string $key): void; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* delete all config keys linked to an app |
|
|
|
|
* |
|
|
|
|
* @param string $app id of the app |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function deleteApp(string $app): void; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Clear the cache. |
|
|
|
|
* |
|
|
|
|
* The cache will be rebuilt only the next time a config value is requested. |
|
|
|
|
* |
|
|
|
|
* @param bool $reload set to TRUE to refill cache instantly after clearing it |
|
|
|
|
* @since 29.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function clearCache(bool $reload = false): void; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* get multiply values, either the app or key can be used as wildcard by setting it to false |
|
|
|
|
* |
|
|
|
|
* @param string|false $key |
|
|
|
|
* @param string|false $app |
|
|
|
|
* |
|
|
|
|
* @return array|false |
|
|
|
|
* @since 7.0.0 |
|
|
|
|
* @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()} |
|
|
|
|
*/ |
|
|
|
|
public function getValues($app, $key); |
|
|
|
|
|
|
|
|
@ -55,18 +567,10 @@ interface IAppConfig { |
|
|
|
|
* get all values of the app or and filters out sensitive data |
|
|
|
|
* |
|
|
|
|
* @param string $app |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
* @since 12.0.0 |
|
|
|
|
* @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()} |
|
|
|
|
*/ |
|
|
|
|
public function getFilteredValues($app); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get all apps using the config |
|
|
|
|
* @return string[] an array of app ids |
|
|
|
|
* |
|
|
|
|
* This function returns a list of all apps that have at least one |
|
|
|
|
* entry in the appconfig table. |
|
|
|
|
* @since 7.0.0 |
|
|
|
|
*/ |
|
|
|
|
public function getApps(); |
|
|
|
|
} |
|
|
|
|