Merge pull request #1531 from owncloud/cron_no_routes
Fix router warnings when running as CLI
This commit is contained in:
commit
07f504812c
18
lib/base.php
18
lib/base.php
|
@ -554,14 +554,16 @@ class OC {
|
||||||
self::checkUpgrade();
|
self::checkUpgrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (!self::$CLI) {
|
||||||
OC::getRouter()->match(OC_Request::getPathInfo());
|
try {
|
||||||
return;
|
OC::getRouter()->match(OC_Request::getPathInfo());
|
||||||
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
|
return;
|
||||||
//header('HTTP/1.0 404 Not Found');
|
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
|
||||||
} catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
|
//header('HTTP/1.0 404 Not Found');
|
||||||
OC_Response::setStatus(405);
|
} catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
|
||||||
return;
|
OC_Response::setStatus(405);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = OC::$REQUESTEDAPP;
|
$app = OC::$REQUESTEDAPP;
|
||||||
|
|
|
@ -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');
|
||||||
$method = $_SERVER['REQUEST_METHOD'];
|
if ( !OC::$CLI) {
|
||||||
|
$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);
|
||||||
|
|
Loading…
Reference in New Issue