From 771d38918a7e8c16b562909233f4a37bca299af1 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 22 Jun 2022 18:19:00 +0200 Subject: [PATCH] avoid early DI of IAppManager - might break install Signed-off-by: Arthur Schiwon --- lib/private/Dashboard/Manager.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 8c596f470fb..6a8348ff88f 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -31,7 +31,8 @@ use OCP\App\IAppManager; use OCP\Dashboard\IManager; use OCP\Dashboard\IWidget; use OCP\ILogger; -use OCP\IServerContainer; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\ContainerInterface; use Throwable; class Manager implements IManager { @@ -43,11 +44,10 @@ class Manager implements IManager { private $widgets = []; private ContainerInterface $serverContainer; - private IAppManager $appManager; + private ?IAppManager $appManager = null; - public function __construct(ContainerInterface $serverContainer, IAppManager $appManager) { + public function __construct(ContainerInterface $serverContainer) { $this->serverContainer = $serverContainer; - $this->appManager = $appManager; } private function registerWidget(IWidget $widget): void { @@ -63,6 +63,9 @@ class Manager implements IManager { } public function loadLazyPanels(): void { + if ($this->appManager === null) { + $this->appManager = $this->serverContainer->get(IAppManager::class); + } $services = $this->lazyWidgets; foreach ($services as $service) { /** @psalm-suppress InvalidCatch */ -- 2.39.5