Merge pull request #3578 from Icinga/fix/cli-command

Fix uninitialized array and module in Cli\Command
This commit is contained in:
Johannes Meyer 2019-04-26 15:55:45 +02:00 committed by GitHub
commit eb7db67dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -48,14 +48,15 @@ abstract class Command
public function __construct(App $app, $moduleName, $commandName, $actionName, $initialize = true) public function __construct(App $app, $moduleName, $commandName, $actionName, $initialize = true)
{ {
$this->app = $app; $this->app = $app;
$this->moduleName = $moduleName; $this->moduleName = $moduleName;
$this->commandName = $commandName; $this->commandName = $commandName;
$this->actionName = $actionName; $this->actionName = $actionName;
$this->params = $app->getParams(); $this->params = $app->getParams();
$this->screen = Screen::instance($app); $this->screen = Screen::instance($app);
$this->trace = $this->params->shift('trace', false); $this->trace = $this->params->shift('trace', false);
$this->isVerbose = $this->params->shift('verbose', false); $this->isVerbose = $this->params->shift('verbose', false);
$this->isDebugging = $this->params->shift('debug', false); $this->isDebugging = $this->params->shift('debug', false);
$this->configs = [];
if ($initialize) { if ($initialize) {
$this->init(); $this->init();
} }
@ -94,7 +95,7 @@ abstract class Command
return $this->config; return $this->config;
} else { } else {
if (! array_key_exists($file, $this->configs)) { if (! array_key_exists($file, $this->configs)) {
$this->configs[$file] = Config::module($module, $file); $this->configs[$file] = Config::app($file);
} }
return $this->configs[$file]; return $this->configs[$file];
} }