]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Console/Config.php
Merge pull request #7068 from MrPetovan/task/7047-theme-error-page
[friendica.git] / src / Core / Console / Config.php
index da2d20fd13fda2ec63fa9b80aeea5c89f44cbf5d..cf5c09fc0a4281bf5e6fe925d768f65e396a8f6c 100644 (file)
@@ -1,11 +1,5 @@
 <?php
 
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
 namespace Friendica\Core\Console;
 
 use Asika\SimpleConsole\CommandArgsException;
@@ -13,9 +7,6 @@ use Friendica\App;
 use Friendica\Core;
 use RuntimeException;
 
-require_once 'include/dba.php';
-require_once 'include/text.php';
-
 /**
  * @brief tool to access the system config from the CLI
  *
@@ -68,7 +59,7 @@ Description
                Sets the value of the provided key in the category
 
 Notes:
-       Setting config entries which are manually set in config/local.ini.php may result in
+       Setting config entries which are manually set in config/local.config.php may result in
        conflict between database settings and the manual startup settings.
 
 Options
@@ -80,7 +71,7 @@ HELP;
 
        protected function doExecute()
        {
-               $a = get_app();
+               $a = \Friendica\BaseObject::getApp();
 
                if ($this->getOption('v')) {
                        $this->out('Executable: ' . $this->executable);
@@ -93,7 +84,7 @@ HELP;
                        throw new CommandArgsException('Too many arguments');
                }
 
-               if (!($a->mode & App::MODE_DBCONFIGAVAILABLE)) {
+               if (!$a->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
                        $this->out('Database isn\'t ready or populated yet, showing file config only');
                }
 
@@ -122,7 +113,7 @@ HELP;
 
                        if (is_array($value)) {
                                foreach ($value as $k => $v) {
-                                       $this->out("{$cat}.{$key}[{$k}] => " . $v);
+                                       $this->out("{$cat}.{$key}[{$k}] => " . (is_array($v) ? implode(', ', $v) : $v));
                                }
                        } else {
                                $this->out("{$cat}.{$key} => " . $value);
@@ -133,12 +124,13 @@ HELP;
                        $cat = $this->getArgument(0);
                        Core\Config::load($cat);
 
-                       if (!is_null($a->config[$cat])) {
+                       if ($a->getConfigCache()->get($cat) !== null) {
                                $this->out("[{$cat}]");
-                               foreach ($a->config[$cat] as $key => $value) {
+                               $catVal = $a->getConfigCache()->get($cat);
+                               foreach ($catVal as $key => $value) {
                                        if (is_array($value)) {
                                                foreach ($value as $k => $v) {
-                                                       $this->out("{$key}[{$k}] => " . $v);
+                                                       $this->out("{$key}[{$k}] => " . (is_array($v) ? implode(', ', $v) : $v));
                                                }
                                        } else {
                                                $this->out("{$key} => " . $value);
@@ -152,16 +144,17 @@ HELP;
                if (count($this->args) == 0) {
                        Core\Config::load();
 
-                       if (Core\Config::get('system', 'config_adapter') == 'jit' && $a->mode & App::MODE_DBCONFIGAVAILABLE) {
+                       if (Core\Config::get('system', 'config_adapter') == 'jit' && $a->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
                                $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 = $a->getConfigCache()->getAll();
+                       foreach ($config as $cat => $section) {
                                if (is_array($section)) {
                                        foreach ($section as $key => $value) {
                                                if (is_array($value)) {
                                                        foreach ($value as $k => $v) {
-                                                               $this->out("{$cat}.{$key}[{$k}] => " . $v);
+                                                               $this->out("{$cat}.{$key}[{$k}] => " . (is_array($v) ? implode(', ', $v) : $v));
                                                        }
                                                } else {
                                                        $this->out("{$cat}.{$key} => " . $value);