diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-10-17 09:43:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-17 09:43:57 +0200 |
commit | 07dffb6df6fbf019cc668c716a95cf9e94e49f04 (patch) | |
tree | 4829b7bc58f879f23c12bab2475204429fd47914 | |
parent | e57feec833d892f67364730b911f0f03e6fbda33 (diff) | |
parent | 4a2f9fab66b714c45ea430b33c88a65a8402b459 (diff) | |
download | nextcloud-server-07dffb6df6fbf019cc668c716a95cf9e94e49f04.tar.gz nextcloud-server-07dffb6df6fbf019cc668c716a95cf9e94e49f04.zip |
Merge pull request #17569 from nextcloud/td/di/middleware
Allow DI in middleware
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 9 | ||||
-rw-r--r-- | lib/private/AppFramework/DependencyInjection/DIContainer.php | 2 |
2 files changed, 2 insertions, 9 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 195d56f3539..d1c5294dae9 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -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) { diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 7f416c3ed90..5f3fa1b6dc6 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -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( |