From 72b2324b68c51baf140c6fab7957b59c31de4832 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Thu, 2 Aug 2012 17:59:18 +0200
Subject: [PATCH] Move loading of routes to OC::getRouter function

---
 lib/base.php   | 1 +
 lib/router.php | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/base.php b/lib/base.php
index 43588944d0..0d9ececc0c 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 5dd51e7915..a721255f29 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';
-- 
GitLab