Merge pull request #1531 from owncloud/cron_no_routes

Fix router warnings when running as CLI
remotes/origin/stable5
blizzz 12 years ago
commit 07f504812c
  1. 18
      lib/base.php
  2. 6
      lib/router.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…
Cancel
Save