3 * System Configuration Class
5 * @file include/Core/Config.php
7 * @brief Contains the class with methods for system configuration
9 namespace Friendica\Core;
14 * @brief Arbitrary system configuration storage
17 * If we ever would decide to return exactly the variable type as entered,
18 * we will have fun with the additional features. :-)
23 * @brief Loads all configuration values of family into a cached storage.
25 * @param string $cat The category of the configuration value
29 public static function load($cat = "config")
31 DI::config()->load($cat);
35 * @brief Get a particular user's config variable given the category name
36 * ($family) and a key.
38 * @param string $cat The category of the configuration value
39 * @param string $key The configuration key to query
40 * @param mixed $default_value optional, The value to return if key is not set (default: null)
41 * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
43 * @return mixed Stored value or null if it does not exist
45 public static function get($cat, $key, $default_value = null, $refresh = false)
47 return DI::config()->get($cat, $key, $default_value, $refresh);
51 * @brief Sets a configuration value for system config
53 * Stores a config value ($value) in the category ($cat) under the key ($key)
55 * Note: Please do not store booleans - convert to 0/1 integer values!
57 * @param string $cat The category of the configuration value
58 * @param string $key The configuration key to set
59 * @param mixed $value The value to store
61 * @return bool Operation success
63 public static function set($cat, $key, $value)
65 return DI::config()->set($cat, $key, $value);
69 * @brief Deletes the given key from the system configuration.
71 * @param string $cat The category of the configuration value
72 * @param string $key The configuration key to delete
76 public static function delete($cat, $key)
78 return DI::config()->delete($cat, $key);