]> git.mxchange.org Git - friendica.git/commitdiff
Fixed new "user config" console feature
authorPhilipp <admin@philipp.info>
Wed, 28 Apr 2021 19:55:23 +0000 (21:55 +0200)
committerPhilipp <admin@philipp.info>
Wed, 28 Apr 2021 20:13:00 +0000 (22:13 +0200)
- Replaced "DI::" call with constructor injection
- Added return value for IPConfig::load() and PreloadPConfig::load()

src/Console/User.php
src/Core/PConfig/IPConfig.php
src/Core/PConfig/PreloadPConfig.php

index 3553d4ab6ab01f61b2699402d8de50c8a6b8cd31..7c524f4bd0709563d6a95cf576ec90fba2f0db88 100644 (file)
@@ -52,6 +52,10 @@ class User extends \Asika\SimpleConsole\Console
         * @var Database
         */
        private $dba;
+       /**
+        * @var IPConfig
+        */
+       private $pConfig;
 
        protected function getHelp()
        {
@@ -89,13 +93,14 @@ HELP;
                return $help;
        }
 
-       public function __construct(App\Mode $appMode, L10n $l10n, Database $dba, array $argv = null)
+       public function __construct(App\Mode $appMode, L10n $l10n, Database $dba, IPConfig $pConfig, array $argv = null)
        {
                parent::__construct($argv);
 
                $this->appMode     = $appMode;
                $this->l10n        = $l10n;
                $this->dba         = $dba;
+               $this->pConfig = $pConfig;
        }
 
        protected function doExecute()
@@ -463,8 +468,7 @@ HELP;
                        }
                }
 
-               $pconfig = \Friendica\DI::pConfig();
-               $values = $pconfig->load($user['uid'], $category);
+               $values = $this->pConfig->load($user['uid'], $category);
 
                switch ($subCmd) {
                        case 'list':
index 809ce3e6097cd2edb0f92185990c7966e483e85c..25d81bd7e9f50a48390df0efc3bdd3aea19a6fdb 100644 (file)
@@ -35,7 +35,7 @@ interface IPConfig
         * @param int $uid The user_id
         * @param string $cat The category of the configuration value
         *
-        * @return void
+        * @return array The loaded config array
         * @see Cache
         *
         */
index b91546d4ee01516645e6edbb31232301c5cf7427..abdc18b15909b6aee6fced81696f0ef236aded30 100644 (file)
@@ -68,6 +68,8 @@ class PreloadPConfig extends BasePConfig
 
                // load the whole category out of the DB into the cache
                $this->configCache->load($uid, $config);
+
+               return $config;
        }
 
        /**