switch OC::getRouter usages to OC::$server->getRouter

This commit is contained in:
Robin Appelman 2014-03-10 14:06:47 +01:00
parent 8ab7d18a6a
commit 26793e1f94
4 changed files with 5 additions and 13 deletions

View File

@ -382,14 +382,6 @@ class OC {
return OC_Config::getValue('session_lifetime', 60 * 60 * 24);
}
/**
* @return \OCP\Route\IRouter
*/
public static function getRouter() {
return self::$server->getRouter();
}
public static function loadAppClassPaths() {
foreach (OC_APP::getEnabledApps() as $app) {
$file = OC_App::getAppPath($app) . '/appinfo/classpath.php';
@ -714,7 +706,7 @@ class OC {
OC_App::loadApps();
}
self::checkSingleUserMode();
OC::getRouter()->match(OC_Request::getRawPathInfo());
OC::$server->getRouter()->match(OC_Request::getRawPathInfo());
return;
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
//header('HTTP/1.0 404 Not Found');

View File

@ -65,8 +65,8 @@ class OC_API {
$name = strtolower($method).$url;
$name = str_replace(array('/', '{', '}'), '_', $name);
if(!isset(self::$actions[$name])) {
OC::getRouter()->useCollection('ocs');
OC::getRouter()->create($name, $url)
OC::$server->getRouter()->useCollection('ocs');
OC::$server->getRouter()->create($name, $url)
->method($method)
->defaults($defaults)
->requirements($requirements)

View File

@ -39,7 +39,7 @@ class URLGenerator implements IURLGenerator {
* Returns a url to the given app and file.
*/
public function linkToRoute($route, $parameters = array()) {
$urlLinkTo = \OC::getRouter()->generate($route, $parameters);
$urlLinkTo = \OC::$server->getRouter()->generate($route, $parameters);
return $urlLinkTo;
}

View File

@ -26,7 +26,7 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
try {
OC::getRouter()->match('/ocs'.OC_Request::getRawPathInfo());
OC::$server->getRouter()->match('/ocs'.OC_Request::getRawPathInfo());
} catch (ResourceNotFoundException $e) {
OC_OCS::notFound();
} catch (MethodNotAllowedException $e) {