Merge pull request #17569 from nextcloud/td/di/middleware

Allow DI in middleware
This commit is contained in:
Roeland Jago Douma 2019-10-17 09:43:57 +02:00 committed by GitHub
commit 07dffb6df6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View file

@ -127,13 +127,6 @@ class Application extends App {
);
});
$container->registerService('OCSShareAPIMiddleware', function (SimpleContainer $c) use ($server) {
return new OCSShareAPIMiddleware(
$server->getShareManager(),
$server->getL10N($c->query('AppName'))
);
});
$container->registerService(ShareInfoMiddleware::class, function () use ($server) {
return new ShareInfoMiddleware(
$server->getShareManager()
@ -142,7 +135,7 @@ class Application extends App {
// Execute middlewares
$container->registerMiddleWare('SharingCheckMiddleware');
$container->registerMiddleWare('OCSShareAPIMiddleware');
$container->registerMiddleWare(OCSShareAPIMiddleware::class);
$container->registerMiddleWare(ShareInfoMiddleware::class);
$container->registerService('MountProvider', function (IContainer $c) {

View file

@ -279,7 +279,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
);
foreach($this->middleWares as $middleWare) {
$dispatcher->registerMiddleware($c[$middleWare]);
$dispatcher->registerMiddleware($c->query($middleWare));
}
$dispatcher->registerMiddleware(