namespace Friendica\Util;
use Exception;
-use Friendica\App;
use Friendica\Core\Addon;
-use Friendica\Core\Config\Cache\ConfigCache;
+use Friendica\Core\Config\Cache;
/**
- * The ConfigFileLoader loads config-files and stores them in a ConfigCache ( @see ConfigCache )
+ * The ConfigFileLoader loads config-files and stores them in a ConfigCache ( @see Cache )
*
* It is capable of loading the following config files:
* - *.config.php (current)
*/
const SAMPLE_END = '-sample';
- /**
- * @var App\Mode
- */
- private $appMode;
/**
* @var string
*/
*/
private $staticDir;
- public function __construct($baseDir, App\Mode $mode)
+ public function __construct(string $basePath)
{
- $this->baseDir = $baseDir;
- $this->configDir = $baseDir . DIRECTORY_SEPARATOR . self::CONFIG_DIR;
- $this->staticDir = $baseDir . DIRECTORY_SEPARATOR . self::STATIC_DIR;
- $this->appMode = $mode;
+ $this->baseDir = $basePath;
+ $this->configDir = $this->baseDir . DIRECTORY_SEPARATOR . self::CONFIG_DIR;
+ $this->staticDir = $this->baseDir . DIRECTORY_SEPARATOR . self::STATIC_DIR;
}
/**
* First loads the default value for all the configuration keys, then the legacy configuration files, then the
* expected local.config.php
*
- * @param ConfigCache $config The config cache to load to
- * @param bool $raw Setup the raw config format
+ * @param Cache $config The config cache to load to
+ * @param bool $raw Setup the raw config format
*
* @throws Exception
*/
- public function setupCache(ConfigCache $config, $raw = false)
+ public function setupCache(Cache $config, $raw = false)
{
// Load static config files first, the order is important
$config->load($this->loadStaticConfig('defaults'));
$this->loadCoreConfig($config);
// In case of install mode, add the found basepath (because there isn't a basepath set yet
- if (!$raw && ($this->appMode->isInstall() || empty($config->get('system', 'basepath')))) {
+ if (!$raw && empty($config->get('system', 'basepath'))) {
// Setting at least the basepath we know
$config->set('system', 'basepath', $this->baseDir);
}
/**
* Tries to load the specified core-configuration into the config cache.
*
- * @param ConfigCache $config The Config cache
+ * @param Cache $config The Config cache
*
* @return array The config array (empty if no config found)
*
* @throws Exception if the configuration file isn't readable
*/
- private function loadCoreConfig(ConfigCache $config)
+ private function loadCoreConfig(Cache $config)
{
// try to load legacy ini-files first
foreach ($this->getConfigFiles(true) as $configFile) {