$this->session = $this->container->create(IHandleUserSessions::class);
$this->appHelper = $this->container->create(AppHelper::class);
+ $addonHelper = $this->container->create(AddonHelper::class);
+
$this->load(
$request->getServerParams(),
$this->container->create(DbaDefinition::class),
$this->config,
$this->profiler,
$this->appHelper,
+ $addonHelper,
);
$this->registerTemplateEngine();
$this->container->create(IManagePersonalConfigValues::class),
$this->container->create(Page::class),
$this->container->create(Nav::class),
- $this->container->create(AddonHelper::class),
+ $addonHelper,
$this->container->create(ModuleHTTPException::class),
$start_time,
$request
$this->container->create(IManageConfigValues::class),
$this->container->create(Profiler::class),
$this->container->create(AppHelper::class),
+ $this->container->create(AddonHelper::class),
);
$this->registerTemplateEngine();
$this->container->create(IManageConfigValues::class),
$this->container->create(Profiler::class),
$this->container->create(AppHelper::class),
+ $this->container->create(AddonHelper::class),
);
/** @var BasePath */
Mode $mode,
IManageConfigValues $config,
Profiler $profiler,
- AppHelper $appHelper
+ AppHelper $appHelper,
+ AddonHelper $addonHelper
): void {
if ($config->get('system', 'ini_max_execution_time') !== false) {
set_time_limit((int) $config->get('system', 'ini_max_execution_time'));
if ($mode->has(Mode::DBAVAILABLE)) {
Core\Hook::loadHooks();
- $loader = (new Config())->createConfigFileManager($appHelper->getBasePath(), $serverParams);
+ $loader = (new Config())->createConfigFileManager($appHelper->getBasePath(), $addonHelper->getAddonPath(), $serverParams);
Core\Hook::callAll('load_config', $loader);
// Hooks are now working, reload the whole definitions with hook enabled
*
* @return Util\ConfigFileManager
*/
- public function createConfigFileManager(string $basePath, array $server = []): Util\ConfigFileManager
+ public function createConfigFileManager(string $basePath, string $addonPath, array $server = []): Util\ConfigFileManager
{
if (!empty($server[self::CONFIG_DIR_ENV]) && is_dir($server[self::CONFIG_DIR_ENV])) {
$configDir = $server[self::CONFIG_DIR_ENV];
}
$staticDir = $basePath . DIRECTORY_SEPARATOR . self::STATIC_DIR;
- return new Util\ConfigFileManager($basePath, $configDir, $staticDir, $server);
+ return new Util\ConfigFileManager($basePath, $addonPath, $configDir, $staticDir, $server);
}
/**
namespace Friendica\Core\Config\Util;
-use Friendica\Core\Addon;
use Friendica\Core\Config\Exception\ConfigFileException;
use Friendica\Core\Config\ValueObject\Cache;
* @var string
*/
private $baseDir;
+ private string $addonDir;
/**
* @var string
*/
* @param string $configDir
* @param string $staticDir
*/
- public function __construct(string $baseDir, string $configDir, string $staticDir, array $server = [])
+ public function __construct(string $baseDir, string $addonDir, string $configDir, string $staticDir, array $server = [])
{
$this->baseDir = $baseDir;
+ $this->addonDir = $addonDir;
$this->configDir = $configDir;
$this->staticDir = $staticDir;
$this->server = $server;
*/
public function loadAddonConfig(string $name): array
{
- $filepath = $this->baseDir . DIRECTORY_SEPARATOR . // /var/www/html/
- Addon::DIRECTORY . DIRECTORY_SEPARATOR . // addon/
- $name . DIRECTORY_SEPARATOR . // openstreetmap/
- 'config' . DIRECTORY_SEPARATOR . // config/
- $name . ".config.php"; // openstreetmap.config.php
+ $filepath = $this->addonDir . DIRECTORY_SEPARATOR . // /var/www/html/addon/
+ $name . DIRECTORY_SEPARATOR . // openstreetmap/
+ 'config' . DIRECTORY_SEPARATOR . // config/
+ $name . ".config.php"; // openstreetmap.config.php
- if (file_exists($filepath)) {
- return $this->loadConfigFile($filepath);
- } else {
+ if (!file_exists($filepath)) {
return [];
}
+
+ return $this->loadConfigFile($filepath);
}
/**
{
parent::content();
- $basePath = DI::appHelper()->getBasePath();
+ $basePath = DI::appHelper()->getBasePath();
+ $addonPath = DI::addonHelper()->getAddonPath();
// are there MyISAM tables in the DB? If so, trigger a warning message
$warningtext = [];
}
// check legacy basepath settings
- $configLoader = (new Config())->createConfigFileManager($basePath, $_SERVER);
+ $configLoader = (new Config())->createConfigFileManager($basePath, $addonPath, $_SERVER);
$configCache = new Cache();
$configLoader->setupCache($configCache);
$confBasepath = $configCache->get('system', 'basepath');
'call' => [
['createConfigFileManager', [
$basepath,
+ $basepath . '/addon',
$serverVars,
], Dice::CHAIN_CALL],
],
return $this->dba;
}
- $configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/');
+ $configFileManager = new ConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ $this->root->url() . '/config',
+ $this->root->url() . '/static'
+ );
$config = new ReadOnlyFileConfig(new Cache([
'database' => [
'disable_pdo' => true
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
$configFileLoader = new ConfigFileManager(
$this->root->url(),
+ $this->root->url() . DIRECTORY_SEPARATOR . 'addon',
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
{
$this->delConfigFile('local.config.php');
- $configFileManager = (new Config())->createConfigFileManager($this->root->url(), ['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/']);
+ $configFileManager = (new Config())->createConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ ['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/'],
+ );
$configCache = new Cache();
$configFileManager->setupCache($configCache);
->at($this->root->getChild('config2'))
->setContent(file_get_contents($fileDir . 'B.config.php'));
- $configFileManager = (new Config())->createConfigFileManager($this->root->url(),
- [
- 'FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url(),
- ]);
+ $configFileManager = (new Config())->createConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ ['FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url()],
+ );
$configCache = new Cache();
$configFileManager->setupCache($configCache);
->at($this->root->getChild('config'))
->setContent('');
- $configFileManager = (new Config())->createConfigFileManager($this->root->url());
+ $configFileManager = (new Config())->createConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ );
$configCache = new Cache();
$configFileManager->setupCache($configCache);
-
- self::assertEquals(1,1);
}
}
parent::setUp();
$this->configCache = new Cache();
- $this->configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/');
+ $this->configFileManager = new ConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ $this->root->url() . '/config',
+ $this->root->url() . '/static'
+ );
}
/**
$this->setConfigFile('static' . DIRECTORY_SEPARATOR . 'env.config.php', true);
$this->loadDirectFixture($this->configToDbArray($data), $this->getDbInstance());
- $configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/', $server);
+ $configFileManager = new ConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ $this->root->url() . '/config',
+ $this->root->url() . '/static',
+ $server
+ );
$configFileManager->setupCache($this->configCache);
$config = new DatabaseConfig($this->getDbInstance(), $this->configCache);
{
parent::setUp();
- $this->configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/');
+ $this->configFileManager = new ConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ $this->root->url() . '/config',
+ $this->root->url() . '/static'
+ );
}
public function dataTests(): array
$this->database = $this->getDbInstance();
$configFactory = new Config();
- $configFileManager = $configFactory->createConfigFileManager($this->root->url());
+ $configFileManager = $configFactory->createConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ );
$configCache = $configFactory->createCache($configFileManager);
$this->config = new \Friendica\Core\Config\Model\DatabaseConfig($this->database, $configCache);
parent::setUp();
$this->configCache = new Cache();
- $this->configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/');
+ $this->configFileManager = new ConfigFileManager(
+ $this->root->url(),
+ $this->root->url() . '/addon',
+ $this->root->url() . '/config',
+ $this->root->url() . '/static'
+ );
}
/**