*/
namespace Friendica\Core;
+use Friendica\App;
use Friendica\BaseObject;
-use Friendica\Core\Config;
require_once 'include/dba.php';
public static function init($uid)
{
- $a = self::getApp();
+ // Database isn't ready or populated yet
+ if (!(self::getApp()->mode & App::MODE_DBCONFIGAVAILABLE)) {
+ return;
+ }
- if (isset($a->config['system']['config_adapter']) && $a->config['system']['config_adapter'] == 'preload') {
+ if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
self::$adapter = new Config\PreloadPConfigAdapter($uid);
} else {
self::$adapter = new Config\JITPConfigAdapter($uid);
*/
public static function load($uid, $family)
{
+ // Database isn't ready or populated yet
+ if (!(self::getApp()->mode & App::MODE_DBCONFIGAVAILABLE)) {
+ return;
+ }
+
if (empty(self::$adapter)) {
self::init($uid);
}
*/
public static function get($uid, $family, $key, $default_value = null, $refresh = false)
{
+ // Database isn't ready or populated yet
+ if (!(self::getApp()->mode & App::MODE_DBCONFIGAVAILABLE)) {
+ return;
+ }
+
if (empty(self::$adapter)) {
self::init($uid);
}
* @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()->mode & App::MODE_DBCONFIGAVAILABLE)) {
+ return false;
+ }
+
if (empty(self::$adapter)) {
self::init($uid);
}
*/
public static function delete($uid, $family, $key)
{
+ // Database isn't ready or populated yet
+ if (!(self::getApp()->mode & App::MODE_DBCONFIGAVAILABLE)) {
+ return false;
+ }
+
if (empty(self::$adapter)) {
self::init($uid);
}