X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FPConfig.php;h=752d919199cdc88a2cb7ea86d9f08bbd878da586;hb=2bfc3d1a0c5eba668b1144bb4a9ab7351aa46b60;hp=bfa52f5a36ebd7e480d97d2c638ccf8a77b2958e;hpb=88353ce56f0e5da6352af2d999a58bd0c9b375f7;p=friendica.git diff --git a/src/Core/PConfig.php b/src/Core/PConfig.php index bfa52f5a36..752d919199 100644 --- a/src/Core/PConfig.php +++ b/src/Core/PConfig.php @@ -8,10 +8,8 @@ */ namespace Friendica\Core; +use Friendica\App; use Friendica\BaseObject; -use Friendica\Core\Config; - -require_once 'include/dba.php'; /** * @brief Management of user configuration storage @@ -31,7 +29,12 @@ class PConfig extends BaseObject { $a = self::getApp(); - if (isset($a->config['system']['config_adapter']) && $a->config['system']['config_adapter'] == 'preload') { + // Database isn't ready or populated yet + if (!$a->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) { + return; + } + + if ($a->getConfigValue('system', 'config_adapter') == 'preload') { self::$adapter = new Config\PreloadPConfigAdapter($uid); } else { self::$adapter = new Config\JITPConfigAdapter($uid); @@ -51,6 +54,11 @@ class PConfig extends BaseObject */ public static function load($uid, $family) { + // Database isn't ready or populated yet + if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) { + return; + } + if (empty(self::$adapter)) { self::init($uid); } @@ -75,6 +83,11 @@ class PConfig extends BaseObject */ public static function get($uid, $family, $key, $default_value = null, $refresh = false) { + // Database isn't ready or populated yet + if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) { + return; + } + if (empty(self::$adapter)) { self::init($uid); } @@ -95,10 +108,15 @@ class PConfig extends BaseObject * @param string $key The configuration key to set * @param string $value The value to store * - * @return mixed Stored $value or false + * @return bool Operation success */ public static function set($uid, $family, $key, $value) { + // Database isn't ready or populated yet + if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) { + return false; + } + if (empty(self::$adapter)) { self::init($uid); } @@ -120,6 +138,11 @@ class PConfig extends BaseObject */ public static function delete($uid, $family, $key) { + // Database isn't ready or populated yet + if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) { + return false; + } + if (empty(self::$adapter)) { self::init($uid); }