]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Config/Capability/IManageConfigValues.php
Introduce ISetConfigValuesTransactional for transactional config behaviour
[friendica.git] / src / Core / Config / Capability / IManageConfigValues.php
index 88fa96314ba7056038808ecd48c310d17957ef26..42ebea0004f207693015b7397cfab2d6082c880a 100644 (file)
@@ -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