3 * System Configuration Class
5 * @file include/Core/Config.php
7 * @brief Contains the class with methods for system configuration
9 namespace Friendica\Core;
11 use Friendica\Core\Config\ConfigCache;
12 use Friendica\Core\Config\IConfigAdapter;
13 use Friendica\Core\Config\IConfigCache;
16 * @brief Arbitrary system configuration storage
19 * If we ever would decide to return exactly the variable type as entered,
20 * we will have fun with the additional features. :-)
25 * @var Config\Configuration
27 private static $config;
30 * Initialize the config
32 * @param Config\Configuration $config
34 public static function init(Config\Configuration $config)
36 self::$config = $config;
40 * @brief Loads all configuration values of family into a cached storage.
42 * @param string $cat The category of the configuration value
46 public static function load($cat = "config")
48 self::$config->load($cat);
52 * @brief Get a particular user's config variable given the category name
53 * ($family) and a key.
55 * @param string $cat The category of the configuration value
56 * @param string $key The configuration key to query
57 * @param mixed $default_value optional, The value to return if key is not set (default: null)
58 * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
60 * @return mixed Stored value or null if it does not exist
62 public static function get($cat, $key, $default_value = null, $refresh = false)
64 return self::$config->get($cat, $key, $default_value, $refresh);
68 * @brief Sets a configuration value for system config
70 * Stores a config value ($value) in the category ($cat) under the key ($key)
72 * Note: Please do not store booleans - convert to 0/1 integer values!
74 * @param string $cat The category of the configuration value
75 * @param string $key The configuration key to set
76 * @param mixed $value The value to store
78 * @return bool Operation success
80 public static function set($cat, $key, $value)
82 return self::$config->set($cat, $key, $value);
86 * @brief Deletes the given key from the system configuration.
88 * @param string $cat The category of the configuration value
89 * @param string $key The configuration key to delete
93 public static function delete($cat, $key)
95 return self::$config->delete($cat, $key);