use Friendica\App;
use Friendica\BaseObject;
-require_once 'include/dba.php';
-
/**
* @brief Management of user configuration storage
* Note:
class PConfig extends BaseObject
{
/**
- * @var Friendica\Core\Config\IPConfigAdapter
+ * @var \Friendica\Core\Config\IPConfigAdapter
*/
private static $adapter = null;
public static function init($uid)
{
+ $a = self::getApp();
+
// Database isn't ready or populated yet
- if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
+ if (!$a->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
return;
}
- if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
+ if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
self::$adapter = new Config\PreloadPConfigAdapter($uid);
} else {
- self::$adapter = new Config\JITPConfigAdapter($uid);
+ self::$adapter = new Config\JITPConfigAdapter();
}
}
* @param string $family The category of the configuration value
*
* @return void
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function load($uid, $family)
{
// Database isn't ready or populated yet
- if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
+ if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
return;
}
* @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
*
* @return mixed Stored value or null if it does not exist
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function get($uid, $family, $key, $default_value = null, $refresh = false)
{
// Database isn't ready or populated yet
- if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
+ if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
return;
}
* Stores a config value ($value) in the category ($family) under the key ($key)
* for the user_id $uid.
*
- * @note Please do not store booleans - convert to 0/1 integer values!
+ * @note Please do not store booleans - convert to 0/1 integer values!
*
* @param string $uid The user_id
* @param string $family The category of the configuration value
* @param string $key The configuration key to set
- * @param string $value The value to store
+ * @param mixed $value The value to store
*
* @return bool Operation success
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function set($uid, $family, $key, $value)
{
// Database isn't ready or populated yet
- if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
+ if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
return false;
}
* @param string $key The configuration key to delete
*
* @return mixed
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function delete($uid, $family, $key)
{
// Database isn't ready or populated yet
- if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
+ if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
return false;
}