X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFactory%2FConfigFactory.php;h=ecec1e2a730e314cc498baa9705508885757d086;hb=b8f85f0484fbb1f37e9cae2f4cf98f9349fda099;hp=46d55b30c3a80d2926e8303bbe7fef142cdeb451;hpb=f3da5b3a2f98883e4a06c345dfe2880394f7d21d;p=friendica.git diff --git a/src/Factory/ConfigFactory.php b/src/Factory/ConfigFactory.php index 46d55b30c3..ecec1e2a73 100644 --- a/src/Factory/ConfigFactory.php +++ b/src/Factory/ConfigFactory.php @@ -3,50 +3,59 @@ namespace Friendica\Factory; 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\ConfigFileLoader; class ConfigFactory { /** - * @param Config\ConfigCacheLoader $loader The Config Cache loader (INI/config/.htconfig) + * @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig) * - * @return Config\ConfigCache + * @return Cache\ConfigCache */ - public static function createCache(Config\ConfigCacheLoader $loader) + public function createCache(ConfigFileLoader $loader) { - $configCache = new Config\ConfigCache(); - $loader->loadConfigFiles($configCache); + $configCache = new Cache\ConfigCache(); + $loader->setupCache($configCache); return $configCache; } /** - * @param string $type The adapter type - * @param Config\IConfigCache $config The config cache of this adapter + * @param Cache\ConfigCache $configCache The config cache of this adapter + * @param ConfigModel $configModel The configuration model * - * @return Config\IConfigAdapter + * @return Config\IConfiguration */ - public static function createConfig($type, $config) + public function createConfig(Cache\ConfigCache $configCache, ConfigModel $configModel) { - if ($type == 'preload') { - return new Config\PreloadConfigAdapter($config); + if ($configCache->get('system', 'config_adapter') === 'preload') { + $configuration = new Config\PreloadConfiguration($configCache, $configModel); } else { - return new Config\JITConfigAdapter($config); + $configuration = new Config\JitConfiguration($configCache, $configModel); } + + + return $configuration; } /** - * @param string $type The adapter type - * @param Config\IPConfigCache $config The config cache of this adapter - * @param int $uid The UID of the current user + * @param Cache\ConfigCache $configCache The config cache + * @param Cache\PConfigCache $pConfigCache The personal config cache + * @param PConfigModel $configModel The configuration model * - * @return Config\IPConfigAdapter + * @return Config\IPConfiguration */ - public static function createPConfig($type, $config, $uid = null) + public function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, PConfigModel $configModel) { - if ($type == 'preload') { - return new Config\PreloadPConfigAdapter($config, $uid); + if ($configCache->get('system', 'config_adapter') === 'preload') { + $configuration = new Config\PreloadPConfiguration($pConfigCache, $configModel); } else { - return new Config\JITPConfigAdapter($config); + $configuration = new Config\JitPConfiguration($pConfigCache, $configModel); } + + return $configuration; } }