From 21fd84d73d3fcc0340bad1f187e10987b6aa596a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 30 Mar 2021 11:40:45 +0200 Subject: [PATCH] Register services during registration instead of boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow all apps to use a propery setup fulltextsearch manager instance when they try to access it during their own boot method Signed-off-by: Julius Härtl --- lib/AppInfo/Application.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 794ecde2..bcbb0845 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -48,6 +48,7 @@ use OCP\IServerContainer; use OCP\IURLGenerator; use Symfony\Component\Routing\Exception\RouteNotFoundException; +use Psr\Container\ContainerInterface; use Throwable; require_once __DIR__ . '/../../vendor/autoload.php'; @@ -76,6 +77,7 @@ public function __construct(array $params = []) { public function register(IRegistrationContext $context): void { $context->registerCapability(Capabilities::class); $context->registerSearchProvider(UnifiedSearchProvider::class); + $this->registerServices($this->getContainer()); } /** @@ -84,7 +86,6 @@ public function register(IRegistrationContext $context): void { * @throws Throwable */ public function boot(IBootContext $context): void { - $context->injectFn(Closure::fromCallable([$this, 'registerServices'])); $context->injectFn(Closure::fromCallable([$this, 'registerNavigation'])); } @@ -92,9 +93,9 @@ public function boot(IBootContext $context): void { /** * Register Navigation Tab * - * @param IServerContainer $container + * @param ContainerInterface $container */ - protected function registerServices(IServerContainer $container) { + protected function registerServices(ContainerInterface $container) { /** @var IFullTextSearchManager $fullTextSearchManager */ $fullTextSearchManager = $container->get(IFullTextSearchManager::class);