Clean code slightly
This commit is contained in:
parent
b563dff10a
commit
b0dc4383e1
25
lib/api.php
25
lib/api.php
|
@ -55,15 +55,7 @@ class OC_API {
|
|||
public static function call($parameters){
|
||||
|
||||
// Get the routes
|
||||
// TODO cache
|
||||
foreach(OC_APP::getEnabledApps() as $app){
|
||||
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
|
||||
if(file_exists($file)){
|
||||
require_once($file);
|
||||
}
|
||||
}
|
||||
// include core routes
|
||||
require_once(OC::$SERVERROOT.'ocs/routes.php');
|
||||
self::loadRoutes();
|
||||
|
||||
$name = $parameters['_name'];
|
||||
$response = array();
|
||||
|
@ -91,6 +83,21 @@ class OC_API {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* loads the api routes
|
||||
*/
|
||||
private static function loadRoutes(){
|
||||
// TODO cache
|
||||
foreach(OC_APP::getEnabledApps() as $app){
|
||||
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
|
||||
if(file_exists($file)){
|
||||
require_once($file);
|
||||
}
|
||||
}
|
||||
// include core routes
|
||||
require_once(OC::$SERVERROOT.'ocs/routes.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* respond to a call
|
||||
* @param int|array $response the response
|
||||
|
|
Loading…
Reference in New Issue