3 * User Configuration Class
5 * @file include/Core/PConfig.php
7 * @brief Contains the class with methods for user configuration
9 namespace Friendica\Core;
14 * @brief Management of user configuration storage
16 * Please do not store booleans - convert to 0/1 integer values
17 * The PConfig::get() functions return boolean false for keys that are unset,
18 * and this could lead to subtle bugs.
23 * @brief Get a particular user's config variable given the category name
26 * @param int $uid The user_id
27 * @param string $cat The category of the configuration value
28 * @param string $key The configuration key to query
29 * @param mixed $default_value optional, The value to return if key is not set (default: null)
30 * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
32 * @return mixed Stored value or null if it does not exist
34 public static function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false)
36 return DI::pConfig()->get($uid, $cat, $key, $default_value, $refresh);
40 * @brief Sets a configuration value for a user
42 * @param int $uid The user_id
43 * @param string $cat The category of the configuration value
44 * @param string $key The configuration key to set
45 * @param mixed $value The value to store
47 * @return bool Operation success
49 public static function set(int $uid, string $cat, string $key, $value)
51 return DI::pConfig()->set($uid, $cat, $key, $value);
55 * @brief Deletes the given key from the users's configuration.
57 * @param int $uid The user_id
58 * @param string $cat The category of the configuration value
59 * @param string $key The configuration key to delete
63 public static function delete(int $uid, string $cat, string $key)
65 return DI::pConfig()->delete($uid, $cat, $key);