$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(
$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');
}
protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
- $mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
+ $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
}