3 namespace Friendica\Factory;
6 use Friendica\Core\Config;
7 use Friendica\Core\Config\Adapter;
8 use Friendica\Core\Config\Cache;
9 use Friendica\Util\Config\ConfigFileLoader;
14 * @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
16 * @return Cache\ConfigCache
18 public static function createCache(ConfigFileLoader $loader)
20 $configCache = new Cache\ConfigCache();
21 $loader->setupCache($configCache);
27 * @param Cache\ConfigCache $configCache The config cache of this adapter
29 * @return Config\Configuration
31 public static function createConfig(Cache\ConfigCache $configCache)
33 if ($configCache->get('system', 'config_adapter') === 'preload') {
34 $configAdapter = new Adapter\PreloadConfigAdapter();
36 $configAdapter = new Adapter\JITConfigAdapter();
39 $configuration = new Config\Configuration($configCache, $configAdapter);
41 // Set the config in the static container for legacy usage
42 Core\Config::init($configuration);
44 return $configuration;
48 * @param Cache\ConfigCache $configCache The config cache of this adapter
49 * @param int $uid The UID of the current user
51 * @return Config\PConfiguration
53 public static function createPConfig(Cache\ConfigCache $configCache, $uid = null)
55 if ($configCache->get('system', 'config_adapter') === 'preload') {
56 $configAdapter = new Adapter\PreloadPConfigAdapter($uid);
58 $configAdapter = new Adapter\JITPConfigAdapter();
61 $configuration = new Config\PConfiguration($configCache, $configAdapter);
63 // Set the config in the static container for legacy usage
64 Core\PConfig::init($configuration);
66 return $configuration;