1) Refactor App->config[] into Core\Config

This commit is contained in:
Philipp Holzer
2019-02-03 18:54:25 +01:00
parent 82f713cb7f
commit be6b229534
11 changed files with 191 additions and 177 deletions

View File

@@ -100,10 +100,10 @@ HELP;
}
}
$db_host = $a->getConfigValue('database', 'hostname');
$db_user = $a->getConfigValue('database', 'username');
$db_pass = $a->getConfigValue('database', 'password');
$db_data = $a->getConfigValue('database', 'database');
$db_host = Config::getConfigValue('database', 'hostname');
$db_user = Config::getConfigValue('database', 'username');
$db_pass = Config::getConfigValue('database', 'password');
$db_data = Config::getConfigValue('database', 'database');
} else {
// Creating config file
$this->out("Creating config file...\n");

View File

@@ -124,9 +124,10 @@ HELP;
$cat = $this->getArgument(0);
Core\Config::load($cat);
if (!is_null($a->config[$cat])) {
if (Core\Config::getConfigValue($cat) !== null) {
$this->out("[{$cat}]");
foreach ($a->config[$cat] as $key => $value) {
$catVal = Core\Config::getConfigValue($cat);
foreach ($catVal as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$this->out("{$key}[{$k}] => " . $v);
@@ -147,7 +148,8 @@ HELP;
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
}
foreach ($a->config as $cat => $section) {
$config = Core\Config::getAll();
foreach ($config as $cat => $section) {
if (is_array($section)) {
foreach ($section as $key => $value) {
if (is_array($value)) {

View File

@@ -41,9 +41,7 @@ HELP;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
$a = \get_app();
$php_path = $a->getConfigValue('config', 'php_path', 'php');
$php_path = \Friendica\Core\Config::getConfigValue('config', 'php_path', 'php');
if ($this->getOption('v')) {
$this->out('Directory: src');