mirror of
https://github.com/friendica/friendica
synced 2025-04-27 09:50:12 +00:00
Refactor PConfiguration
This commit is contained in:
parent
ff99a62584
commit
9d98a4ce3a
16 changed files with 1084 additions and 690 deletions
|
@ -4,9 +4,9 @@ namespace Friendica\Factory;
|
|||
|
||||
use Friendica\Core;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\Adapter;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Model\Config\Config as ConfigModel;
|
||||
use Friendica\Model\Config\PConfig as PConfigModel;
|
||||
use Friendica\Util\Config\ConfigFileLoader;
|
||||
|
||||
class ConfigFactory
|
||||
|
@ -48,20 +48,18 @@ class ConfigFactory
|
|||
/**
|
||||
* @param Cache\ConfigCache $configCache The config cache
|
||||
* @param Cache\PConfigCache $pConfigCache The personal config cache
|
||||
* @param int $uid The UID of the current user
|
||||
* @param PConfigModel $configModel The configuration model
|
||||
*
|
||||
* @return Config\PConfiguration
|
||||
*/
|
||||
public static function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, $uid = null)
|
||||
public static function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, PConfigModel $configModel)
|
||||
{
|
||||
if ($configCache->get('system', 'config_adapter') === 'preload') {
|
||||
$configAdapter = new Adapter\PreloadPConfigAdapter($uid);
|
||||
$configuration = new Config\PreloadPConfiguration($pConfigCache, $configModel);
|
||||
} else {
|
||||
$configAdapter = new Adapter\JITPConfigAdapter();
|
||||
$configuration = new Config\JitPConfiguration($pConfigCache, $configModel);
|
||||
}
|
||||
|
||||
$configuration = new Config\PConfiguration($pConfigCache, $configAdapter);
|
||||
|
||||
// Set the config in the static container for legacy usage
|
||||
Core\PConfig::init($configuration);
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ class DependencyFactory
|
|||
$configModel = new \Friendica\Model\Config\Config($database);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache, $configModel);
|
||||
// needed to call PConfig::init()
|
||||
Factory\ConfigFactory::createPConfig($configCache, new PConfigCache());
|
||||
$pconfigModel = new \Friendica\Model\Config\PConfig($database);
|
||||
Factory\ConfigFactory::createPConfig($configCache, new PConfigCache(), $pconfigModel);
|
||||
$logger = Factory\LoggerFactory::create($channel, $database, $config, $profiler);
|
||||
Factory\LoggerFactory::createDev($channel, $config, $profiler);
|
||||
$baseURL = new BaseURL($config, $_SERVER);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue