]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix running tests from cli
authorRobin Appelman <icewind@owncloud.com>
Wed, 27 Jun 2012 11:21:45 +0000 (13:21 +0200)
committerRobin Appelman <icewind@owncloud.com>
Wed, 27 Jun 2012 11:21:45 +0000 (13:21 +0200)
lib/base.php
lib/helper.php

index 11e63e208eb81c7dea76578b55c606f7ee4a15ba..c2b0bbef78020a0cbcbd9ec36ee63c6aa3fcc7d2 100644 (file)
@@ -170,8 +170,10 @@ class OC{
        public static function checkInstalled() {
                // Redirect to installer if not installed
                if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') {
-                       $url = 'http://'.$_SERVER['SERVER_NAME'].OC::$WEBROOT.'/index.php';
-                       header("Location: $url");
+                       if(!OC::$CLI){
+                               $url = 'http://'.$_SERVER['SERVER_NAME'].OC::$WEBROOT.'/index.php';
+                               header("Location: $url");
+                       }
                        exit();
                }
        }
@@ -180,7 +182,7 @@ class OC{
                // redirect to https site if configured
                if( OC_Config::getValue( "forcessl", false )){
                        ini_set("session.cookie_secure", "on");
-                       if(OC_Helper::serverProtocol()<>'https') {
+                       if(OC_Helper::serverProtocol()<>'https' and !OC::$CLI) {
                                $url = "https://". OC_Helper::serverHost() . $_SERVER['REQUEST_URI'];
                                header("Location: $url");
                                exit();
index 37914b73e17d46efa15d5ba48b3a1413798d4ce5..6ab55f27618154006faf1ca4d54cd7fa5cc77166 100644 (file)
@@ -75,6 +75,9 @@ class OC_Helper {
         * reverse proxies
         */
        public static function serverHost() {
+               if(OC::$CLI){
+                       return 'localhost';
+               }
                if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
                        if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ",") !== false) {
                                $host = trim(array_pop(explode(",", $_SERVER['HTTP_X_FORWARDED_HOST'])));