diff --git a/lib/api.php b/lib/api.php index 46f58debdcf5301b02f9bb684af200533f758eea..17663b53b8441f25a2adcbce348564d3f6f2d3e1 100644 --- a/lib/api.php +++ b/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