aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/base.php1
-rw-r--r--lib/router.php7
-rw-r--r--ocs/v1.php1
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index 43588944d04..0d9ececc0c9 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -278,6 +278,7 @@ class OC{
public static function getRouter() {
if (!isset(OC::$router)) {
OC::$router = new OC_Router();
+ OC::$router->loadRoutes();
}
return OC::$router;
diff --git a/lib/router.php b/lib/router.php
index c3864cfc91c..5c5171cf82d 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -16,10 +16,15 @@ class OC_Router {
protected $collections = array();
protected $collection = null;
+ public function __construct() {
+ // TODO cache
+ $this->loadRoutes();
+ }
+
/**
* loads the api routes
*/
- public function loadRoutes(){
+ public function loadRoutes() {
// TODO cache
foreach(OC_APP::getEnabledApps() as $app){
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
diff --git a/ocs/v1.php b/ocs/v1.php
index cb8a1faf876..938a57009f7 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -26,7 +26,6 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
OC::getRouter()->useCollection('ocs');
-OC::getRouter()->loadRoutes();
try {
OC::getRouter()->match($_SERVER['PATH_INFO']);