Move loading of routes to OC::getRouter function

This commit is contained in:
Bart Visscher 2012-08-02 17:59:18 +02:00
parent 3722928c46
commit 72b2324b68
2 changed files with 7 additions and 1 deletions

View File

@ -278,6 +278,7 @@ class OC{
public static function getRouter() { public static function getRouter() {
if (!isset(OC::$router)) { if (!isset(OC::$router)) {
OC::$router = new OC_Router(); OC::$router = new OC_Router();
OC::$router->loadRoutes();
} }
return OC::$router; return OC::$router;

View File

@ -16,10 +16,15 @@ class OC_Router {
protected $collections = array(); protected $collections = array();
protected $collection = null; protected $collection = null;
public function __construct() {
// TODO cache
$this->loadRoutes();
}
/** /**
* loads the api routes * loads the api routes
*/ */
public function loadRoutes(){ public function loadRoutes() {
// TODO cache // TODO cache
foreach(OC_APP::getEnabledApps() as $app){ foreach(OC_APP::getEnabledApps() as $app){
$file = OC_App::getAppPath($app).'/appinfo/routes.php'; $file = OC_App::getAppPath($app).'/appinfo/routes.php';