3 namespace Friendica\Factory;
6 use Friendica\Core\Config;
7 use Friendica\Core\Config\Adapter;
8 use Friendica\Core\Config\Cache;
13 * @param Cache\ConfigCacheLoader $loader The Config Cache loader (INI/config/.htconfig)
15 * @return Cache\ConfigCache
17 public static function createCache(Cache\ConfigCacheLoader $loader)
19 $configCache = new Cache\ConfigCache();
20 $loader->loadConfigFiles($configCache);
26 * @param Cache\ConfigCache $configCache The config cache of this adapter
28 * @return Config\Configuration
30 public static function createConfig(Cache\ConfigCache $configCache)
32 if ($configCache->get('system', 'config_adapter') === 'preload') {
33 $configAdapter = new Adapter\PreloadConfigAdapter();
35 $configAdapter = new Adapter\JITConfigAdapter();
38 $configuration = new Config\Configuration($configCache, $configAdapter);
40 // Set the config in the static container for legacy usage
41 Core\Config::init($configuration);
43 return $configuration;
47 * @param Cache\ConfigCache $configCache The config cache of this adapter
48 * @param int $uid The UID of the current user
50 * @return Config\PConfiguration
52 public static function createPConfig(Cache\ConfigCache $configCache, $uid = null)
54 if ($configCache->get('system', 'config_adapter') === 'preload') {
55 $configAdapter = new Adapter\PreloadPConfigAdapter($uid);
57 $configAdapter = new Adapter\JITPConfigAdapter();
60 $configuration = new Config\PConfiguration($configCache, $configAdapter);
62 // Set the config in the static container for legacy usage
63 Core\PConfig::init($configuration);
65 return $configuration;