]> git.mxchange.org Git - friendica.git/blob - src/Core/Config/IConfigAdapter.php
ee5ca3ca544f759ca606a8610711464bcfd23357
[friendica.git] / src / Core / Config / IConfigAdapter.php
1 <?php\r
2 \r
3 namespace Friendica\Core\Config;\r
4 \r
5 /**\r
6  *\r
7  * @author Hypolite Petovan <mrpetovan@gmail.com>\r
8  */\r
9 interface IConfigAdapter\r
10 {\r
11         /**\r
12          * @brief Loads all configuration values into a cached storage.\r
13          *\r
14          * All configuration values of the system are stored in global cache\r
15          * which is available under the global variable $a->config\r
16          *\r
17          * @param string  $cat The category of the configuration values to load\r
18          *\r
19          * @return void\r
20          */\r
21         public function load($cat = "config");\r
22 \r
23         /**\r
24          * @brief Get a particular user's config variable given the category name\r
25          * ($family) and a key.\r
26          *\r
27          * Get a particular config value from the given category ($family)\r
28          * and the $key from a cached storage in $a->config[$uid].\r
29          * $instore is only used by the set_config function\r
30          * to determine if the key already exists in the DB\r
31          * If a key is found in the DB but doesn't exist in\r
32          * local config cache, pull it into the cache so we don't have\r
33          * to hit the DB again for this item.\r
34          *\r
35          * @param string  $cat           The category of the configuration value\r
36          * @param string  $k             The configuration key to query\r
37          * @param mixed   $default_value optional, The value to return if key is not set (default: null)\r
38          * @param boolean $refresh       optional, If true the config is loaded from the db and not from the cache (default: false)\r
39          *\r
40          * @return mixed Stored value or null if it does not exist\r
41          */\r
42         public function get($cat, $k, $default_value = null, $refresh = false);\r
43 \r
44         /**\r
45          * @brief Sets a configuration value for system config\r
46          *\r
47          * Stores a config value ($value) in the category ($family) under the key ($key)\r
48          * for the user_id $uid.\r
49          *\r
50          * Note: Please do not store booleans - convert to 0/1 integer values!\r
51          *\r
52          * @param string $family The category of the configuration value\r
53          * @param string $key    The configuration key to set\r
54          * @param mixed  $value  The value to store\r
55          *\r
56          * @return mixed Stored $value or false if the database update failed\r
57          */\r
58         public function set($cat, $k, $value);\r
59 \r
60         /**\r
61          * @brief Deletes the given key from the system configuration.\r
62          *\r
63          * Removes the configured value from the stored cache in $a->config\r
64          * and removes it from the database.\r
65          *\r
66          * @param string $cat The category of the configuration value\r
67          * @param string $k   The configuration key to delete\r
68          *\r
69          * @return mixed\r
70          */\r
71         public function delete($cat, $k);\r
72 }\r