diff --git a/src/Core/Config.php b/src/Core/Config.php index c8edcb2928..0db8f0b882 100644 --- a/src/Core/Config.php +++ b/src/Core/Config.php @@ -8,9 +8,6 @@ */ namespace Friendica\Core; -use Friendica\Core\Config\IConfigAdapter; -use Friendica\Core\Config\IConfigCache; - /** * @brief Arbitrary system configuration storage * @@ -21,19 +18,19 @@ use Friendica\Core\Config\IConfigCache; class Config { /** - * @var IConfigAdapter + * @var Config\IConfigAdapter */ private static $adapter; /** - * @var IConfigCache + * @var Config\IConfigCache */ private static $config; /** * Initialize the config with only the cache * - * @param IConfigCache $config The configuration cache + * @param Config\IConfigCache $config The configuration cache */ public static function init($config) { @@ -43,7 +40,7 @@ class Config /** * Add the adapter for DB-backend * - * @param $adapter + * @param Config\IConfigAdapter $adapter */ public static function setAdapter($adapter) { diff --git a/src/Core/Config/ConfigCache.php b/src/Core/Config/ConfigCache.php index b50ba3e004..355b1df2f5 100644 --- a/src/Core/Config/ConfigCache.php +++ b/src/Core/Config/ConfigCache.php @@ -2,6 +2,13 @@ namespace Friendica\Core\Config; +/** + * The Friendica config cache for the application + * Initial, all *.config.php files are loaded into this cache with the + * ConfigCacheLoader ( @see ConfigCacheLoader ) + * + * Is used for further caching operations too (depending on the ConfigAdapter ) + */ class ConfigCache implements IConfigCache, IPConfigCache { /** @@ -12,12 +19,15 @@ class ConfigCache implements IConfigCache, IPConfigCache */ public $config; - public function __construct($config = [], $overwrite = false) + /** + * @param array $config A initial config array + */ + public function __construct($config = []) { $this->config = []; if (isset($config)) { - $this->loadConfigArray($config, $overwrite); + $this->loadConfigArray($config, true); } } diff --git a/src/Core/Config/ConfigCacheLoader.php b/src/Core/Config/ConfigCacheLoader.php index 287be7d522..a23e1e848a 100644 --- a/src/Core/Config/ConfigCacheLoader.php +++ b/src/Core/Config/ConfigCacheLoader.php @@ -2,15 +2,29 @@ namespace Friendica\Core\Config; +/** + * The ConfigCacheLoader loads config-files and stores them in a ConfigCache ( @see ConfigCache ) + * + * It is capable of loading the following config files: + * - *.config.php (current) + * - *.ini.php (deprecated) + * - *.htconfig.php (deprecated) + */ class ConfigCacheLoader { + /** + * The Sub directory of the config-files + * @var string + */ + const SUBDIRECTORY = '/config/'; + private $baseDir; private $configDir; public function __construct($baseDir) { $this->baseDir = $baseDir; - $this->configDir = $baseDir . '/config/'; + $this->configDir = $baseDir . self::SUBDIRECTORY; } /** diff --git a/src/Core/Config/IConfigCache.php b/src/Core/Config/IConfigCache.php index 191333c44a..8266cc2dd4 100644 --- a/src/Core/Config/IConfigCache.php +++ b/src/Core/Config/IConfigCache.php @@ -2,6 +2,9 @@ namespace Friendica\Core\Config; +/** + * The interface for a system-wide ConfigCache + */ interface IConfigCache { /** diff --git a/src/Core/Config/IPConfigCache.php b/src/Core/Config/IPConfigCache.php index a17e5a03be..6a57dafa89 100644 --- a/src/Core/Config/IPConfigCache.php +++ b/src/Core/Config/IPConfigCache.php @@ -2,6 +2,9 @@ namespace Friendica\Core\Config; +/** + * The interface for a user-specific config cache + */ interface IPConfigCache { /** diff --git a/src/Core/PConfig.php b/src/Core/PConfig.php index 1f9f36638d..8782a20d23 100644 --- a/src/Core/PConfig.php +++ b/src/Core/PConfig.php @@ -8,8 +8,6 @@ */ namespace Friendica\Core; -use Friendica\Core\Config\IPConfigCache; - /** * @brief Management of user configuration storage * Note: @@ -20,19 +18,19 @@ use Friendica\Core\Config\IPConfigCache; class PConfig { /** - * @var \Friendica\Core\Config\IPConfigAdapter + * @var Config\IPConfigAdapter */ private static $adapter; /** - * @var IPConfigCache + * @var Config\IPConfigCache */ private static $config; /** * Initialize the config with only the cache * - * @param IPConfigCache $config The configuration cache + * @param Config\IPConfigCache $config The configuration cache */ public static function init($config) { @@ -42,7 +40,7 @@ class PConfig /** * Add the adapter for DB-backend * - * @param $adapter + * @param Config\IPConfigAdapter $adapter */ public static function setAdapter($adapter) { @@ -59,7 +57,6 @@ class PConfig * @param string $family The category of the configuration value * * @return void - * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function load($uid, $family) { @@ -129,7 +126,6 @@ class PConfig * @param string $key The configuration key to delete * * @return mixed - * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function delete($uid, $family, $key) {