diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-16 18:08:03 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-21 21:43:18 +0300 |
commit | 91e7f12088cb87ffef5660429ece404364167978 (patch) | |
tree | baf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/federatedfilesharing | |
parent | e029055e766298c5852eedabf06ff42b06a50198 (diff) |
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/federatedfilesharing')
-rw-r--r-- | apps/federatedfilesharing/lib/AppInfo/Application.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index 09f881d5bb8..1afaa01a48f 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -28,6 +28,7 @@ namespace OCA\FederatedFileSharing\AppInfo; +use Closure; use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener; use OCA\FederatedFileSharing\Notifier; use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles; @@ -36,6 +37,9 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\Federation\ICloudFederationProviderManager; +use OCP\Notification\IManager as INotifiactionManager; +use Psr\Container\ContainerInterface; class Application extends App implements IBootstrap { public function __construct() { @@ -47,16 +51,20 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - $server = $context->getServerContainer(); + $context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider'])); + $context->injectFn(Closure::fromCallable([$this, 'registerNotificationManager'])); + } - $cloudFederationManager = $server->getCloudFederationProviderManager(); - $cloudFederationManager->addCloudFederationProvider('file', + private function registerCloudFederationProvider(ICloudFederationProviderManager $manager, + ContainerInterface $container): void { + $manager->addCloudFederationProvider('file', 'Federated Files Sharing', - function () use ($server) { - return $server->query(CloudFederationProviderFiles::class); + function () use ($container) { + return $container->get(CloudFederationProviderFiles::class); }); + } - $manager = $server->getNotificationManager(); + private function registerNotificationManager(INotifiactionManager $manager): void { $manager->registerNotifierService(Notifier::class); } } |