3 namespace Friendica\Factory;
6 use Friendica\Core\Config;
7 use Friendica\Core\Config\Cache;
8 use Friendica\Model\Config\Config as ConfigModel;
9 use Friendica\Model\Config\PConfig as PConfigModel;
10 use Friendica\Util\ConfigFileLoader;
15 * @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
17 * @return Cache\ConfigCache
19 public function createCache(ConfigFileLoader $loader)
21 $configCache = new Cache\ConfigCache();
22 $loader->setupCache($configCache);
28 * @param Cache\ConfigCache $configCache The config cache of this adapter
29 * @param ConfigModel $configModel The configuration model
31 * @return Config\Configuration
33 public function createConfig(Cache\ConfigCache $configCache, ConfigModel $configModel)
35 if ($configCache->get('system', 'config_adapter') === 'preload') {
36 $configuration = new Config\PreloadConfiguration($configCache, $configModel);
38 $configuration = new Config\JitConfiguration($configCache, $configModel);
42 // Set the config in the static container for legacy usage
43 Core\Config::init($configuration);
45 return $configuration;
49 * @param Cache\ConfigCache $configCache The config cache
50 * @param Cache\PConfigCache $pConfigCache The personal config cache
51 * @param PConfigModel $configModel The configuration model
53 * @return Config\PConfiguration
55 public function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, PConfigModel $configModel)
57 if ($configCache->get('system', 'config_adapter') === 'preload') {
58 $configuration = new Config\PreloadPConfiguration($pConfigCache, $configModel);
60 $configuration = new Config\JitPConfiguration($pConfigCache, $configModel);
63 // Set the config in the static container for legacy usage
64 Core\PConfig::init($configuration);
66 return $configuration;