From 0a318925a4bf5ee41cee4869f97a4276c2bc8d23 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 11 Feb 2019 23:45:08 +0100 Subject: [PATCH] bugfixing adapter get() in case of no connection --- src/Core/Config/Adapter/IConfigAdapter.php | 6 +++--- src/Core/Config/Adapter/IPConfigAdapter.php | 4 ++-- src/Core/Config/Adapter/JITPConfigAdapter.php | 2 +- src/Core/Config/Adapter/PreloadConfigAdapter.php | 2 +- src/Core/Config/Adapter/PreloadPConfigAdapter.php | 2 +- src/Core/Logger.php | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Core/Config/Adapter/IConfigAdapter.php b/src/Core/Config/Adapter/IConfigAdapter.php index 8223d33672..21cd9a4b2a 100644 --- a/src/Core/Config/Adapter/IConfigAdapter.php +++ b/src/Core/Config/Adapter/IConfigAdapter.php @@ -9,7 +9,7 @@ namespace Friendica\Core\Config\Adapter; 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 * @@ -18,7 +18,7 @@ interface IConfigAdapter 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. * * @param string $cat The category of the configuration value @@ -60,7 +60,7 @@ interface IConfigAdapter 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 $key The configuration key diff --git a/src/Core/Config/Adapter/IPConfigAdapter.php b/src/Core/Config/Adapter/IPConfigAdapter.php index e9f389292b..8e6c050b27 100644 --- a/src/Core/Config/Adapter/IPConfigAdapter.php +++ b/src/Core/Config/Adapter/IPConfigAdapter.php @@ -15,7 +15,7 @@ namespace Friendica\Core\Config\Adapter; 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 $cat The category of the configuration value @@ -71,7 +71,7 @@ interface IPConfigAdapter 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 $cat The configuration category diff --git a/src/Core/Config/Adapter/JITPConfigAdapter.php b/src/Core/Config/Adapter/JITPConfigAdapter.php index 697e27128a..c5f3a381ed 100644 --- a/src/Core/Config/Adapter/JITPConfigAdapter.php +++ b/src/Core/Config/Adapter/JITPConfigAdapter.php @@ -49,7 +49,7 @@ class JITPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdap public function get($uid, $cat, $key) { if (!$this->isConnected()) { - return null; + return '!!'; } $pconfig = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $key]); diff --git a/src/Core/Config/Adapter/PreloadConfigAdapter.php b/src/Core/Config/Adapter/PreloadConfigAdapter.php index a12c2a7ca6..fa691a16d3 100644 --- a/src/Core/Config/Adapter/PreloadConfigAdapter.php +++ b/src/Core/Config/Adapter/PreloadConfigAdapter.php @@ -47,7 +47,7 @@ class PreloadConfigAdapter extends AbstractDbaConfigAdapter implements IConfigAd public function get($cat, $key) { if (!$this->isConnected()) { - return null; + return '!!'; } $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]); diff --git a/src/Core/Config/Adapter/PreloadPConfigAdapter.php b/src/Core/Config/Adapter/PreloadPConfigAdapter.php index d1c44d9fb6..e79a4a1e3c 100644 --- a/src/Core/Config/Adapter/PreloadPConfigAdapter.php +++ b/src/Core/Config/Adapter/PreloadPConfigAdapter.php @@ -59,7 +59,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig public function get($uid, $cat, $key) { if (!$this->isConnected()) { - return null; + return '!!'; } if (!$this->config_loaded) { diff --git a/src/Core/Logger.php b/src/Core/Logger.php index 67e58ef6b1..3cb22e1e47 100644 --- a/src/Core/Logger.php +++ b/src/Core/Logger.php @@ -68,7 +68,7 @@ class Logger extends BaseObject * * @param LoggerInterface $logger The Logger instance of this Application */ - public static function init($logger) + public static function init(LoggerInterface $logger) { self::$logger = $logger; } @@ -78,7 +78,7 @@ class Logger extends BaseObject * * @param LoggerInterface $logger The Logger instance of this Application */ - public static function setDevLogger($logger) + public static function setDevLogger(LoggerInterface $logger) { self::$devLogger = $logger; }