X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFactory%2FConfigFactory.php;h=9a20100b2fe6da880d4877171c88c1c18a25b38a;hb=5d61599964e74bb733816a5592eee2aed3bbba4e;hp=559411d62370425b605410cfa9918bbe0188d3bb;hpb=b0e06699da8ca4ba173e94f78e08297ef06382f7;p=friendica.git diff --git a/src/Factory/ConfigFactory.php b/src/Factory/ConfigFactory.php index 559411d623..9a20100b2f 100644 --- a/src/Factory/ConfigFactory.php +++ b/src/Factory/ConfigFactory.php @@ -1,68 +1,83 @@ . + * + */ namespace Friendica\Factory; -use Friendica\Core; +use Exception; use Friendica\Core\Config; use Friendica\Core\Config\Cache; use Friendica\Model\Config\Config as ConfigModel; use Friendica\Model\Config\PConfig as PConfigModel; -use Friendica\Util\Config\ConfigFileLoader; +use Friendica\Util\ConfigFileLoader; class ConfigFactory { /** * @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig) * - * @return Cache\ConfigCache + * @return Cache + * + * @throws Exception */ - public static function createCache(ConfigFileLoader $loader) + public function createCache(ConfigFileLoader $loader, array $server = []) { - $configCache = new Cache\ConfigCache(); - $loader->setupCache($configCache); + $configCache = new Cache(); + $loader->setupCache($configCache, $server); return $configCache; } /** - * @param Cache\ConfigCache $configCache The config cache of this adapter + * @param Cache $configCache The config cache of this adapter * @param ConfigModel $configModel The configuration model * - * @return Config\Configuration + * @return Config\IConfig */ - public static function createConfig(Cache\ConfigCache $configCache, ConfigModel $configModel) + public function createConfig(Cache $configCache, ConfigModel $configModel) { if ($configCache->get('system', 'config_adapter') === 'preload') { - $configuration = new Config\PreloadConfiguration($configCache, $configModel); + $configuration = new Config\PreloadConfig($configCache, $configModel); } else { - $configuration = new Config\JitConfiguration($configCache, $configModel); + $configuration = new Config\JitConfig($configCache, $configModel); } - // Set the config in the static container for legacy usage - Core\Config::init($configuration); - return $configuration; } /** - * @param Cache\ConfigCache $configCache The config cache - * @param Cache\PConfigCache $pConfigCache The personal config cache - * @param PConfigModel $configModel The configuration model + * @param Cache $configCache The config cache + * @param \Friendica\Core\PConfig\Cache $pConfigCache The personal config cache + * @param PConfigModel $configModel The configuration model * - * @return Config\PConfiguration + * @return \Friendica\Core\PConfig\IPConfig */ - public static function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, PConfigModel $configModel) + public function createPConfig(Cache $configCache, \Friendica\Core\PConfig\Cache $pConfigCache, PConfigModel $configModel) { if ($configCache->get('system', 'config_adapter') === 'preload') { - $configuration = new Config\PreloadPConfiguration($pConfigCache, $configModel); + $configuration = new \Friendica\Core\PConfig\PreloadPConfig($pConfigCache, $configModel); } else { - $configuration = new Config\JitPConfiguration($pConfigCache, $configModel); + $configuration = new \Friendica\Core\PConfig\JitPConfig($pConfigCache, $configModel); } - // Set the config in the static container for legacy usage - Core\PConfig::init($configuration); - return $configuration; } }