diff options
author | blizzz <blizzz@owncloud.com> | 2013-02-07 11:22:58 -0800 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2013-02-07 11:22:58 -0800 |
commit | 07f504812c89f35cf3167fb38e581d6437ef9142 (patch) | |
tree | e5a7e24af994d3019f3eb01e2e6ef722563314ea | |
parent | 6cff5418a75775b9cb2f8c877797b469d5cd3ce9 (diff) | |
parent | 73ed62976de60ed1ab6728944d638e5b9b4b4e10 (diff) | |
download | nextcloud-server-07f504812c89f35cf3167fb38e581d6437ef9142.tar.gz nextcloud-server-07f504812c89f35cf3167fb38e581d6437ef9142.zip |
Merge pull request #1531 from owncloud/cron_no_routes
Fix router warnings when running as CLI
-rw-r--r-- | lib/base.php | 18 | ||||
-rw-r--r-- | lib/router.php | 6 |
2 files changed, 15 insertions, 9 deletions
diff --git a/lib/base.php b/lib/base.php index b432f282aaf..5bfdb0b7c0a 100644 --- a/lib/base.php +++ b/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; diff --git a/lib/router.php b/lib/router.php index 746b68c2c0c..dbaca9e0d5d 100644 --- a/lib/router.php +++ b/lib/router.php @@ -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); |