]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix creating the share controller
authorJoas Schilling <coding@schilljs.com>
Wed, 15 Apr 2020 12:06:23 +0000 (14:06 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Sat, 18 Apr 2020 09:21:28 +0000 (11:21 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files_sharing/lib/AppInfo/Application.php

index 34db7441daaabdb7f49af4833cc266ca39126069..23db5e3ce32e0f4add8d0496f4547b92f84f76ea 100644 (file)
@@ -80,48 +80,10 @@ class Application extends App {
                $mountProviderCollection = $server->getMountProviderCollection();
                $notifications = $server->getNotificationManager();
 
-               /**
-                * Controllers
-                */
-               $container->registerService('ShareController', function (SimpleContainer $c) use ($server) {
-                       $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
-                       return new ShareController(
-                               $c->query('AppName'),
-                               $c->query('Request'),
-                               $server->getConfig(),
-                               $server->getURLGenerator(),
-                               $server->getUserManager(),
-                               $server->getLogger(),
-                               $server->getActivityManager(),
-                               $server->getShareManager(),
-                               $server->getSession(),
-                               $server->getPreviewManager(),
-                               $server->getRootFolder(),
-                               $federatedSharingApp->getFederatedShareProvider(),
-                               $server->getEventDispatcher(),
-                               $server->getL10N($c->query('AppName')),
-                               $server->query(Defaults::class)
-                       );
-               });
-               $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
-                       return new ExternalSharesController(
-                               $c->query('AppName'),
-                               $c->query('Request'),
-                               $c->query('ExternalManager'),
-                               $c->query('HttpClientService')
-                       );
-               });
-
                /**
                 * Core class wrappers
                 */
-               $container->registerService('HttpClientService', function (SimpleContainer $c) use ($server) {
-                       return $server->getHTTPClientService();
-               });
-               $container->registerService(ICloudIdManager::class, function (SimpleContainer $c) use ($server) {
-                       return $server->getCloudIdManager();
-               });
-               $container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) {
+               $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) {
                        $user = $server->getUserSession()->getUser();
                        $uid = $user ? $user->getUID() : null;
                        return new \OCA\Files_Sharing\External\Manager(
@@ -138,43 +100,14 @@ class Application extends App {
                                $uid
                        );
                });
-               $container->registerAlias(Manager::class, 'ExternalManager');
 
                /**
                 * Middleware
                 */
-               $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use ($server) {
-                       return new SharingCheckMiddleware(
-                               $c->query('AppName'),
-                               $server->getConfig(),
-                               $server->getAppManager(),
-                               $server->query(IControllerMethodReflector::class),
-                               $server->getShareManager(),
-                               $server->getRequest()
-                       );
-               });
-
-               $container->registerService(ShareInfoMiddleware::class, function () use ($server) {
-                       return new ShareInfoMiddleware(
-                               $server->getShareManager()
-                       );
-               });
-
-               // Execute middlewares
-               $container->registerMiddleWare('SharingCheckMiddleware');
+               $container->registerMiddleWare(SharingCheckMiddleware::class);
                $container->registerMiddleWare(OCSShareAPIMiddleware::class);
                $container->registerMiddleWare(ShareInfoMiddleware::class);
 
-               $container->registerService('MountProvider', function (IContainer $c) {
-                       /** @var \OCP\IServerContainer $server */
-                       $server = $c->query('ServerContainer');
-                       return new MountProvider(
-                               $server->getConfig(),
-                               $server->getShareManager(),
-                               $server->getLogger()
-                       );
-               });
-
                $container->registerService('ExternalMountProvider', function (IContainer $c) {
                        /** @var \OCP\IServerContainer $server */
                        $server = $c->query('ServerContainer');
@@ -205,7 +138,7 @@ class Application extends App {
        }
 
        protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
-               $mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
+               $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
                $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
        }