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