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();
|
||||
}
|
||||
|
||||
try {
|
||||
OC::getRouter()->match(OC_Request::getPathInfo());
|
||||
return;
|
||||
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
|
||||
//header('HTTP/1.0 404 Not Found');
|
||||
} catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
|
||||
OC_Response::setStatus(405);
|
||||
return;
|
||||
if (!self::$CLI) {
|
||||
try {
|
||||
OC::getRouter()->match(OC_Request::getPathInfo());
|
||||
return;
|
||||
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
|
||||
//header('HTTP/1.0 404 Not Found');
|
||||
} catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
|
||||
OC_Response::setStatus(405);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$app = OC::$REQUESTEDAPP;
|
||||
|
|
|
@ -23,7 +23,11 @@ class OC_Router {
|
|||
|
||||
public function __construct() {
|
||||
$baseUrl = OC_Helper::linkTo('', 'index.php');
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
if ( !OC::$CLI) {
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
}else{
|
||||
$method = 'GET';
|
||||
}
|
||||
$host = OC_Request::serverHost();
|
||||
$schema = OC_Request::serverProtocol();
|
||||
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
|
||||
|
|
Loading…
Reference in New Issue