mirror of
https://github.com/friendica/friendica
synced 2025-04-27 05:50:10 +00:00
Introduce ISetConfigValuesTransactional for transactional config behaviour
This commit is contained in:
parent
4d4b4a8858
commit
65d79d4c93
14 changed files with 588 additions and 150 deletions
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Core\Config\Capability;
|
||||
|
||||
use Friendica\Core\Config\Exception\ConfigPersistenceException;
|
||||
use Friendica\Core\Config\Util\ConfigFileManager;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
|
||||
/**
|
||||
|
@ -57,6 +58,20 @@ interface IManageConfigValues
|
|||
*/
|
||||
public function get(string $cat, string $key, $default_value = null);
|
||||
|
||||
/**
|
||||
* Load all configuration values from a given cache and saves it back in the configuration node store
|
||||
* @see ConfigFileManager::CONFIG_DATA_FILE
|
||||
*
|
||||
* All configuration values of the system are stored in the cache.
|
||||
*
|
||||
* @param Cache $cache a new cache
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ConfigPersistenceException In case the persistence layer throws errors
|
||||
*/
|
||||
public function load(Cache $cache);
|
||||
|
||||
/**
|
||||
* Sets a configuration value for system config
|
||||
*
|
||||
|
@ -67,20 +82,21 @@ interface IManageConfigValues
|
|||
* @param string $cat The category of the configuration value
|
||||
* @param string $key The configuration key to set
|
||||
* @param mixed $value The value to store
|
||||
* @param bool $autosave If true, implicit save the value
|
||||
*
|
||||
* @return bool Operation success
|
||||
*
|
||||
* @throws ConfigPersistenceException In case the persistence layer throws errors
|
||||
*/
|
||||
public function set(string $cat, string $key, $value, bool $autosave = true): bool;
|
||||
public function set(string $cat, string $key, $value): bool;
|
||||
|
||||
/**
|
||||
* Save back the overridden values of the config cache
|
||||
* Creates a transactional config value store, which is used to set a bunch of values at once
|
||||
*
|
||||
* @throws ConfigPersistenceException In case the persistence layer throws errors
|
||||
* It relies on the current instance, so after save(), the values of this config class will get altered at once too.
|
||||
*
|
||||
* @return ISetConfigValuesTransactional
|
||||
*/
|
||||
public function save();
|
||||
public function transactional(): ISetConfigValuesTransactional;
|
||||
|
||||
/**
|
||||
* Deletes the given key from the system configuration.
|
||||
|
@ -89,14 +105,13 @@ interface IManageConfigValues
|
|||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
* @param string $key The configuration key to delete
|
||||
* @param bool $autosave If true, implicit save the value
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws ConfigPersistenceException In case the persistence layer throws errors
|
||||
*
|
||||
*/
|
||||
public function delete(string $cat, string $key, bool $autosave = true): bool;
|
||||
public function delete(string $cat, string $key): bool;
|
||||
|
||||
/**
|
||||
* Returns the Config Cache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue