3 namespace Friendica\Factory;
6 use Friendica\Core\Config;
7 use Friendica\Core\Config\Adapter;
8 use Friendica\Core\Config\Cache;
9 use Friendica\Model\Config\Config as ConfigModel;
10 use Friendica\Util\Config\ConfigFileLoader;
15 * @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
17 * @return Cache\ConfigCache
19 public static 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 static 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 int $uid The UID of the current user
53 * @return Config\PConfiguration
55 public static function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, $uid = null)
57 if ($configCache->get('system', 'config_adapter') === 'preload') {
58 $configAdapter = new Adapter\PreloadPConfigAdapter($uid);
60 $configAdapter = new Adapter\JITPConfigAdapter();
63 $configuration = new Config\PConfiguration($pConfigCache, $configAdapter);
65 // Set the config in the static container for legacy usage
66 Core\PConfig::init($configuration);
68 return $configuration;