Merge pull request #1531 from owncloud/cron_no_routes

Fix router warnings when running as CLI
This commit is contained in:
blizzz 2013-02-07 11:22:58 -08:00
commit 07f504812c
2 changed files with 15 additions and 9 deletions

View File

@ -554,6 +554,7 @@ class OC {
self::checkUpgrade(); self::checkUpgrade();
} }
if (!self::$CLI) {
try { try {
OC::getRouter()->match(OC_Request::getPathInfo()); OC::getRouter()->match(OC_Request::getPathInfo());
return; return;
@ -563,6 +564,7 @@ class OC {
OC_Response::setStatus(405); OC_Response::setStatus(405);
return; return;
} }
}
$app = OC::$REQUESTEDAPP; $app = OC::$REQUESTEDAPP;
$file = OC::$REQUESTEDFILE; $file = OC::$REQUESTEDFILE;

View File

@ -23,7 +23,11 @@ class OC_Router {
public function __construct() { public function __construct() {
$baseUrl = OC_Helper::linkTo('', 'index.php'); $baseUrl = OC_Helper::linkTo('', 'index.php');
if ( !OC::$CLI) {
$method = $_SERVER['REQUEST_METHOD']; $method = $_SERVER['REQUEST_METHOD'];
}else{
$method = 'GET';
}
$host = OC_Request::serverHost(); $host = OC_Request::serverHost();
$schema = OC_Request::serverProtocol(); $schema = OC_Request::serverProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema); $this->context = new RequestContext($baseUrl, $method, $host, $schema);