mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Introduce ConfigFileManager for config files
This commit is contained in:
parent
fea4b202c1
commit
0f91d1cbde
21 changed files with 343 additions and 302 deletions
|
@ -21,12 +21,12 @@
|
|||
|
||||
namespace Friendica\Core\Config\Factory;
|
||||
|
||||
use Friendica\Core\Config\Capability;
|
||||
use Friendica\Core\Config\Repository;
|
||||
use Friendica\Core\Config\Type;
|
||||
use Friendica\Core\Config\Util;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
|
||||
/**
|
||||
* The config factory for creating either the cache or the whole model
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
|
@ -54,9 +54,9 @@ class Config
|
|||
* @param string $basePath The basepath of FRIENDICA
|
||||
* @param array $server The $_SERVER array
|
||||
*
|
||||
* @return Util\ConfigFileLoader
|
||||
* @return Util\ConfigFileManager
|
||||
*/
|
||||
public function createConfigFileLoader(string $basePath, array $server = []): Util\ConfigFileLoader
|
||||
public function createConfigFileLoader(string $basePath, array $server = []): Util\ConfigFileManager
|
||||
{
|
||||
if (!empty($server[self::CONFIG_DIR_ENV]) && is_dir($server[self::CONFIG_DIR_ENV])) {
|
||||
$configDir = $server[self::CONFIG_DIR_ENV];
|
||||
|
@ -65,19 +65,19 @@ class Config
|
|||
}
|
||||
$staticDir = $basePath . DIRECTORY_SEPARATOR . self::STATIC_DIR;
|
||||
|
||||
return new Util\ConfigFileLoader($basePath, $configDir, $staticDir);
|
||||
return new Util\ConfigFileManager($basePath, $configDir, $staticDir, new Util\ConfigFileTransformer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Util\ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
|
||||
* @param array $server
|
||||
* @param Util\ConfigFileManager $configFileManager The Config Cache manager (INI/config/.htconfig)
|
||||
* @param array $server
|
||||
*
|
||||
* @return Cache
|
||||
*/
|
||||
public function createCache(Util\ConfigFileLoader $loader, array $server = []): Cache
|
||||
public function createCache(Util\ConfigFileManager $configFileManager, array $server = []): Cache
|
||||
{
|
||||
$configCache = new Cache();
|
||||
$loader->setupCache($configCache, $server);
|
||||
$configFileManager->setupCache($configCache, $server);
|
||||
|
||||
return $configCache;
|
||||
}
|
||||
|
@ -88,12 +88,12 @@ class Config
|
|||
*
|
||||
* @return Capability\IManageConfigValues
|
||||
*/
|
||||
public function create(Cache $configCache, Repository\Config $configRepo)
|
||||
public function create(Util\ConfigFileManager $loader, Cache $configCache, Repository\Config $configRepo)
|
||||
{
|
||||
if ($configCache->get('system', 'config_adapter') === 'preload') {
|
||||
$configuration = new Type\PreloadConfig($configCache, $configRepo);
|
||||
$configuration = new Type\PreloadConfig($loader, $configCache, $configRepo);
|
||||
} else {
|
||||
$configuration = new Type\JitConfig($configCache, $configRepo);
|
||||
$configuration = new Type\JitConfig($loader, $configCache, $configRepo);
|
||||
}
|
||||
|
||||
return $configuration;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue