Skip to content

Commit

Permalink
Register services during registration instead of boot
Browse files Browse the repository at this point in the history
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 <jus@bitgrid.net>
  • Loading branch information
juliushaertl authored and ArtificialOwl committed Aug 10, 2021
1 parent b116b81 commit 4b8aa6b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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());
}

/**
Expand All @@ -84,17 +86,16 @@ 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']));
}


/**
* 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);

Expand Down

0 comments on commit 4b8aa6b

Please sign in to comment.