]> git.mxchange.org Git - friendica.git/blob - include/config.php
c51db4ec7b1f7fc9f550bdf3818014553a5e9ec1
[friendica.git] / include / config.php
1 <?php
2 /**
3  * @file include/config.php
4  * 
5  *  @brief (Deprecated) Arbitrary configuration storage
6  * Note:
7  * Please do not store booleans - convert to 0/1 integer values
8  * The get_?config() functions return boolean false for keys that are unset,
9  * and this could lead to subtle bugs.
10  *
11  * There are a few places in the code (such as the admin panel) where boolean
12  * configurations need to be fixed as of 10/08/2011.
13  */
14
15 use \Friendica\Core\Config;
16 use \Friendica\Core\PConfig;
17
18 /**
19  * @brief (Deprecated) Loads all configuration values of family into a cached storage.
20  *
21  * Note: This function is deprecated. Use Config::load() instead.
22  *
23  * @param string $family
24  *  The category of the configuration value
25  * @return void
26  */
27 function load_config($family) {
28         return Config::load($family);
29 }
30
31 /**
32  * @brief (Deprecated) Get a particular user's config variable given the category name
33  * ($family) and a key.
34  *
35  * Note: This function is deprecated. Use Config::get() instead.
36  *
37  * @param string $family
38  *  The category of the configuration value
39  * @param string $key
40  *  The configuration key to query
41  * @param boolean $refresh
42  *  If true the config is loaded from the db and not from the cache
43  * @return mixed Stored value or false if it does not exist
44  */
45 function get_config($family, $key, $refresh = false) {
46         $v = Config::get($family, $key, false, $refresh);
47         return $v;
48 }
49
50 /**
51  * @brief (Deprecated) Sets a configuration value for system config
52  *
53  * Note: This function is deprecated. Use Config::set() instead.
54  *
55  * @param string $family
56  *  The category of the configuration value
57  * @param string $key
58  *  The configuration key to set
59  * @param string $value
60  *  The value to store
61  * @return mixed Stored $value or false if the database update failed
62  */
63 function set_config($family,$key,$value) {
64         return Config::set($family, $key, $value);
65 }
66
67 /**
68  * @brief (Deprecated) Deletes the given key from the system configuration.
69  *
70  * Note: This function is deprecated. Use Config::delete() instead.
71  *
72  * @param string $family
73  *  The category of the configuration value
74  * @param string $key
75  *  The configuration key to delete
76  * @return mixed
77  */
78 function del_config($family,$key) {
79         return Config::delete($family, $key);
80 }
81
82 /**
83  * @brief (Deprecated) Loads all configuration values of a user's config family into a cached storage.
84  *
85  * Note: This function is deprecated. Use PConfig::load() instead.
86  *
87  * @param string $uid
88  *  The user_id
89  * @param string $family
90  *  The category of the configuration value
91  * @return void
92  */
93 function load_pconfig($uid,$family) {
94         return PConfig::load($uid, $family);
95 }
96
97 /**
98  * @brief (Deprecated) Get a particular user's config variable given the category name
99  * ($family) and a key.
100  *
101  * Note: This function is deprecated. Use PConfig::get() instead.
102  *
103  * @param string $uid
104  *  The user_id
105  * @param string $family
106  *  The category of the configuration value
107  * @param string $key
108  *  The configuration key to query
109  * @param boolean $refresh
110  *  If true the config is loaded from the db and not from the cache
111  * @return mixed Stored value or false if it does not exist
112  */
113 function get_pconfig($uid, $family, $key, $refresh = false) {
114         $v = PConfig::get($uid, $family, $key, false, $refresh);
115         return $v;
116 }
117
118 /**
119  * @brief (Deprecated) Sets a configuration value for a user
120  *
121  * Note: This function is deprecated. Use PConfig::set() instead.
122  *
123  * @param string $uid
124  *  The user_id
125  * @param string $family
126  *  The category of the configuration value
127  * @param string $key
128  *  The configuration key to set
129  * @param string $value
130  *  The value to store
131  * @return mixed Stored $value or false
132  */
133 function set_pconfig($uid,$family,$key,$value) {
134         return PConfig::set($uid, $family, $key, $value);
135 }
136
137 /**
138  * @brief (Deprecated) Deletes the given key from the users's configuration.
139  *
140  * Note: This function is deprecated. Use PConfig::delete() instead.
141  *
142  * @param string $uid The user_id
143  * @param string $family
144  *  The category of the configuration value
145  * @param string $key
146  *  The configuration key to delete
147  * @return mixed
148  */
149 function del_pconfig($uid,$family,$key) {
150         return PConfig::delete($uid, $family, $key);
151 }