]> source.dussan.org Git - nextcloud-server.git/commitdiff
delay middleware registrations
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 27 Sep 2013 15:15:26 +0000 (17:15 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Fri, 27 Sep 2013 15:15:26 +0000 (17:15 +0200)
lib/appframework/dependencyinjection/dicontainer.php

index 54878266939df1c103500920c0bcc014019c612a..380a0ee6d4a2dada164c5395bbfd8e5558c4a854 100644 (file)
@@ -40,6 +40,10 @@ use OCP\IServerContainer;
 
 class DIContainer extends SimpleContainer implements IAppContainer{
 
+       /**
+        * @var array
+        */
+       private $middleWares;
 
        /**
         * Put your class dependencies in here
@@ -89,6 +93,10 @@ class DIContainer extends SimpleContainer implements IAppContainer{
                        $dispatcher = new MiddlewareDispatcher();
                        $dispatcher->registerMiddleware($c['SecurityMiddleware']);
 
+                       foreach($this->middleWares as $middleWare) {
+                               $dispatcher->registerMiddleware($middleWare);
+                       }
+
                        return $dispatcher;
                });
 
@@ -125,10 +133,7 @@ class DIContainer extends SimpleContainer implements IAppContainer{
         * @return boolean
         */
        function registerMiddleWare(IMiddleWare $middleWare) {
-               /** @var $dispatcher MiddlewareDispatcher */
-               $dispatcher = $this->query('MiddlewareDispatcher');
-               $dispatcher->registerMiddleware($middleWare);
-
+               array_push($this->middleWares, $middleWare);
        }
 
        /**