diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-24 08:01:08 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-24 08:01:50 +0300 |
commit | de925df0623cb0c0539c09e20cff1b893bd2271d (patch) | |
tree | 984bca7211ba2f71ec3e01d2e9c37beb6dba1b8f /plugins/Diagnostics | |
parent | ab55be3d40510454cb2b4eb79608c19d4e7799ed (diff) |
#7759 Get the service lazily to avoid the console from crashing if there's a DI config error
Diffstat (limited to 'plugins/Diagnostics')
-rw-r--r-- | plugins/Diagnostics/Commands/Run.php | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/plugins/Diagnostics/Commands/Run.php b/plugins/Diagnostics/Commands/Run.php index 8014ac24cc..1932faae51 100644 --- a/plugins/Diagnostics/Commands/Run.php +++ b/plugins/Diagnostics/Commands/Run.php @@ -22,19 +22,6 @@ use Symfony\Component\Console\Output\OutputInterface; */ class Run extends ConsoleCommand { - /** - * @var DiagnosticService - */ - private $diagnosticService; - - public function __construct() - { - // Replace this with dependency injection once available - $this->diagnosticService = StaticContainer::get('Piwik\Plugins\Diagnostics\DiagnosticService'); - - parent::__construct(); - } - protected function configure() { $this->setName('diagnostics:run') @@ -44,9 +31,13 @@ class Run extends ConsoleCommand protected function execute(InputInterface $input, OutputInterface $output) { + // Replace this with dependency injection once available + /** @var DiagnosticService $diagnosticService */ + $diagnosticService = StaticContainer::get('Piwik\Plugins\Diagnostics\DiagnosticService'); + $showAll = $input->getOption('all'); - $report = $this->diagnosticService->runDiagnostics(); + $report = $diagnosticService->runDiagnostics(); foreach ($report->getAllResults() as $result) { $items = $result->getItems(); |