Move loading of routes to OC::getRouter function
This commit is contained in:
parent
37ef522b05
commit
6ba2623485
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in New Issue