]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix routes getting lost when loading app routes twice
authorRobin Appelman <icewind@owncloud.com>
Tue, 25 Mar 2014 13:28:30 +0000 (14:28 +0100)
committerRobin Appelman <icewind@owncloud.com>
Tue, 25 Mar 2014 13:28:30 +0000 (14:28 +0100)
lib/private/route/router.php

index a9fad7bc292a81bbf9b473c26fd9937d500f40e8..bad74c925fae763fb8306a7e5dad8b1edeb94a98 100644 (file)
@@ -114,12 +114,14 @@ class Router implements IRouter {
                        }
                }
                foreach ($routingFiles as $app => $file) {
-                       $this->loadedApps[$app] = true;
-                       $this->useCollection($app);
-                       require_once $file;
-                       $collection = $this->getCollection($app);
-                       $collection->addPrefix('/apps/' . $app);
-                       $this->root->addCollection($collection);
+                       if (!$this->loadedApps[$app]) {
+                               $this->loadedApps[$app] = true;
+                               $this->useCollection($app);
+                               require_once $file;
+                               $collection = $this->getCollection($app);
+                               $collection->addPrefix('/apps/' . $app);
+                               $this->root->addCollection($collection);
+                       }
                }
                if (!isset($this->loadedApps['core'])) {
                        $this->loadedApps['core'] = true;
@@ -181,7 +183,7 @@ class Router implements IRouter {
                        // empty string / 'apps' / $app / rest of the route
                        list(, , $app,) = explode('/', $url, 4);
                        $this->loadRoutes($app);
-               } else if(substr($url, 0, 6) === '/core/' or substr($url, 0, 5) === '/ocs/' or substr($url, 0, 10) === '/settings/') {
+               } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 5) === '/ocs/' or substr($url, 0, 10) === '/settings/') {
                        $this->loadRoutes('core');
                } else {
                        $this->loadRoutes();