aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-07-16 17:08:03 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-07-21 20:43:18 +0200
commit91e7f12088cb87ffef5660429ece404364167978 (patch)
treebaf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/files
parente029055e766298c5852eedabf06ff42b06a50198 (diff)
downloadnextcloud-server-91e7f12088cb87ffef5660429ece404364167978.tar.gz
nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.zip
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/AppInfo/Application.php34
1 files changed, 12 insertions, 22 deletions
diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php
index 9500f91fdf9..08ec9fbbcc4 100644
--- a/apps/files/lib/AppInfo/Application.php
+++ b/apps/files/lib/AppInfo/Application.php
@@ -34,6 +34,7 @@ declare(strict_types=1);
namespace OCA\Files\AppInfo;
+use Closure;
use OC\Search\Provider\File;
use OCA\Files\Capabilities;
use OCA\Files\Collaboration\Resources\Listener;
@@ -53,6 +54,7 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\IContainer;
use OCP\IL10N;
+use OCP\ISearch;
use OCP\IServerContainer;
use OCP\Notification\IManager;
use OCP\Util;
@@ -112,35 +114,25 @@ class Application extends App implements IBootstrap {
}
public function boot(IBootContext $context): void {
- $this->registerCollaboration($context);
- Listener::register($context->getServerContainer()->getEventDispatcher());
- $this->registerNotification($context);
- $this->registerSearchProvider($context);
+ $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration']));
+ $context->injectFn([Listener::class, 'register']);
+ $context->injectFn(Closure::fromCallable([$this, 'registerNotification']));
+ $context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider']));
$this->registerTemplates();
- $this->registerNavigation($context);
+ $context->injectFn(Closure::fromCallable([$this, 'registerNavigation']));
$this->registerHooks();
}
- /**
- * Register Collaboration ResourceProvider
- */
- private function registerCollaboration(IBootContext $context): void {
- /** @var IProviderManager $providerManager */
- $providerManager = $context->getAppContainer()->query(IProviderManager::class);
+ private function registerCollaboration(IProviderManager $providerManager): void {
$providerManager->registerResourceProvider(ResourceProvider::class);
}
- private function registerNotification(IBootContext $context): void {
- /** @var IManager $notifications */
- $notifications = $context->getAppContainer()->query(IManager::class);
+ private function registerNotification(IManager $notifications): void {
$notifications->registerNotifierService(Notifier::class);
}
- /**
- * @param IBootContext $context
- */
- private function registerSearchProvider(IBootContext $context): void {
- $context->getServerContainer()->getSearch()->registerProvider(File::class, ['apps' => ['files']]);
+ private function registerSearchProvider(ISearch $search): void {
+ $search->registerProvider(File::class, ['apps' => ['files']]);
}
private function registerTemplates(): void {
@@ -150,9 +142,7 @@ class Application extends App implements IBootstrap {
$templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
}
- private function registerNavigation(IBootContext $context): void {
- /** @var IL10N $l10n */
- $l10n = $context->getAppContainer()->query(IL10N::class);
+ private function registerNavigation(IL10N $l10n): void {
\OCA\Files\App::getNavigationManager()->add(function () use ($l10n) {
return [
'id' => 'files',