From f80bc4ed5370af66e5275dd9fb92d1a61d38b46b Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 7 Jan 2013 15:34:42 +0100 Subject: [PATCH 1/3] fixed error that displayed a white page and a warning that routes could not be loaded from apps that was caused by the ocs_api merge --- lib/router.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/router.php b/lib/router.php index 27e14c38ab..070d31999b 100644 --- a/lib/router.php +++ b/lib/router.php @@ -58,23 +58,6 @@ class OC_Router { * loads the api routes */ public function loadRoutes() { - - // TODO cache - $this->root = $this->getCollection('root'); - foreach(OC_APP::getEnabledApps() as $app){ - $file = OC_App::getAppPath($app).'/appinfo/routes.php'; - if(file_exists($file)){ - $this->useCollection($app); - require_once($file); - $collection = $this->getCollection($app); - $this->root->addCollection($collection, '/apps/'.$app); - } - } - // include ocs routes - require_once(OC::$SERVERROOT.'/ocs/routes.php'); - $collection = $this->getCollection('ocs'); - $this->root->addCollection($collection, '/ocs'); - foreach($this->getRoutingFiles() as $app => $file) { $this->useCollection($app); require_once $file; From 5ccbfd907942648a9b50131bb9a43122b8147e0d Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 7 Jan 2013 15:48:45 +0100 Subject: [PATCH 2/3] readded ocs routes --- lib/router.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/router.php b/lib/router.php index 070d31999b..504d2f357c 100644 --- a/lib/router.php +++ b/lib/router.php @@ -58,6 +58,11 @@ class OC_Router { * loads the api routes */ public function loadRoutes() { + // include ocs routes + require_once(OC::$SERVERROOT.'/ocs/routes.php'); + $collection = $this->getCollection('ocs'); + $this->root->addCollection($collection, '/ocs'); + foreach($this->getRoutingFiles() as $app => $file) { $this->useCollection($app); require_once $file; From 75dbe8866499102b9f97c3584f5b71b50d53b07e Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 7 Jan 2013 21:57:13 +0100 Subject: [PATCH 3/3] added cleanup recommendations by including ocs in the cachedKey method and moving the ocs routes stuff at the end of the loadRoutes method --- lib/router.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/router.php b/lib/router.php index 504d2f357c..746b68c2c0 100644 --- a/lib/router.php +++ b/lib/router.php @@ -49,6 +49,7 @@ class OC_Router { $files = $this->getRoutingFiles(); $files[] = 'settings/routes.php'; $files[] = 'core/routes.php'; + $files[] = 'ocs/routes.php'; $this->cache_key = OC_Cache::generateCacheKeyFromFiles($files); } return $this->cache_key; @@ -58,11 +59,6 @@ class OC_Router { * loads the api routes */ public function loadRoutes() { - // include ocs routes - require_once(OC::$SERVERROOT.'/ocs/routes.php'); - $collection = $this->getCollection('ocs'); - $this->root->addCollection($collection, '/ocs'); - foreach($this->getRoutingFiles() as $app => $file) { $this->useCollection($app); require_once $file; @@ -73,6 +69,10 @@ class OC_Router { require_once 'settings/routes.php'; require_once 'core/routes.php'; + // include ocs routes + require_once 'ocs/routes.php'; + $collection = $this->getCollection('ocs'); + $this->root->addCollection($collection, '/ocs'); } protected function getCollection($name) {