bugfixing adapter get() in case of no connection
This commit is contained in:
parent
ad1254c49c
commit
0a318925a4
|
@ -9,7 +9,7 @@ namespace Friendica\Core\Config\Adapter;
|
||||||
interface IConfigAdapter
|
interface IConfigAdapter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Loads all configuration values into a cached storage.
|
* Loads all configuration values and returns the loaded category as an array.
|
||||||
*
|
*
|
||||||
* @param string $cat The category of the configuration values to load
|
* @param string $cat The category of the configuration values to load
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,7 @@ interface IConfigAdapter
|
||||||
public function load($cat = "config");
|
public function load($cat = "config");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a particular user's config variable given the category name
|
* Get a particular system-wide config variable given the category name
|
||||||
* ($family) and a key.
|
* ($family) and a key.
|
||||||
*
|
*
|
||||||
* @param string $cat The category of the configuration value
|
* @param string $cat The category of the configuration value
|
||||||
|
@ -60,7 +60,7 @@ interface IConfigAdapter
|
||||||
public function isConnected();
|
public function isConnected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks, if a config value ($value) in the category ($cat) is already loaded.
|
* Checks, if a config key ($key) in the category ($cat) is already loaded.
|
||||||
*
|
*
|
||||||
* @param string $cat The configuration category
|
* @param string $cat The configuration category
|
||||||
* @param string $key The configuration key
|
* @param string $key The configuration key
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Friendica\Core\Config\Adapter;
|
||||||
interface IPConfigAdapter
|
interface IPConfigAdapter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Loads all configuration values of a user's config family into a cached storage.
|
* Loads all configuration values of a user's config family and returns the loaded category as an array.
|
||||||
*
|
*
|
||||||
* @param string $uid The user_id
|
* @param string $uid The user_id
|
||||||
* @param string $cat The category of the configuration value
|
* @param string $cat The category of the configuration value
|
||||||
|
@ -71,7 +71,7 @@ interface IPConfigAdapter
|
||||||
public function isConnected();
|
public function isConnected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks, if a config value ($value) in the category ($cat) is already loaded for the user_id $uid.
|
* Checks, if a config key ($key) in the category ($cat) is already loaded for the user_id $uid.
|
||||||
*
|
*
|
||||||
* @param string $uid The user_id
|
* @param string $uid The user_id
|
||||||
* @param string $cat The configuration category
|
* @param string $cat The configuration category
|
||||||
|
|
|
@ -49,7 +49,7 @@ class JITPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdap
|
||||||
public function get($uid, $cat, $key)
|
public function get($uid, $cat, $key)
|
||||||
{
|
{
|
||||||
if (!$this->isConnected()) {
|
if (!$this->isConnected()) {
|
||||||
return null;
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $key]);
|
$pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $key]);
|
||||||
|
|
|
@ -47,7 +47,7 @@ class PreloadConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAd
|
||||||
public function get($cat, $key)
|
public function get($cat, $key)
|
||||||
{
|
{
|
||||||
if (!$this->isConnected()) {
|
if (!$this->isConnected()) {
|
||||||
return null;
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]);
|
$config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
||||||
public function get($uid, $cat, $key)
|
public function get($uid, $cat, $key)
|
||||||
{
|
{
|
||||||
if (!$this->isConnected()) {
|
if (!$this->isConnected()) {
|
||||||
return null;
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->config_loaded) {
|
if (!$this->config_loaded) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Logger extends BaseObject
|
||||||
*
|
*
|
||||||
* @param LoggerInterface $logger The Logger instance of this Application
|
* @param LoggerInterface $logger The Logger instance of this Application
|
||||||
*/
|
*/
|
||||||
public static function init($logger)
|
public static function init(LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
self::$logger = $logger;
|
self::$logger = $logger;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class Logger extends BaseObject
|
||||||
*
|
*
|
||||||
* @param LoggerInterface $logger The Logger instance of this Application
|
* @param LoggerInterface $logger The Logger instance of this Application
|
||||||
*/
|
*/
|
||||||
public static function setDevLogger($logger)
|
public static function setDevLogger(LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
self::$devLogger = $logger;
|
self::$devLogger = $logger;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user