summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-10-21 17:33:49 +0200
committerLukas Reschke <lukas@owncloud.com>2015-10-21 17:33:49 +0200
commit23e22c52b07b963e022a17c7ee8cff19f1223484 (patch)
treefb205162b447eb382a4aa017803e2b3584722f95
parent8133d46620efa39b74dbb216acbed82efad8c4d2 (diff)
downloadnextcloud-server-23e22c52b07b963e022a17c7ee8cff19f1223484.tar.gz
nextcloud-server-23e22c52b07b963e022a17c7ee8cff19f1223484.zip
Use IRequest's `getScriptName` functionality instead of $_SERVER['SCRIPT_NAME']
-rw-r--r--lib/base.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 09e1d0aea49..95a47dec1e2 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -133,7 +133,18 @@ class OC {
OC_Config::$object = new \OC\Config(self::$configDir);
OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
- $scriptName = $_SERVER['SCRIPT_NAME'];
+ /**
+ * FIXME: The following lines are required because we can't yet instantiiate
+ * \OC::$server->getRequest() since \OC::$server does not yet exist.
+ */
+ $params = [
+ 'server' => [
+ 'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME'],
+ 'SCRIPT_FILENAME' => $_SERVER['SCRIPT_FILENAME'],
+ ],
+ ];
+ $fakeRequest = new \OC\AppFramework\Http\Request($params, null, new \OC\AllConfig(new \OC\SystemConfig()));
+ $scriptName = $fakeRequest->getScriptName();
if (substr($scriptName, -1) == '/') {
$scriptName .= 'index.php';
//make sure suburi follows the same rules as scriptName
@@ -145,6 +156,7 @@ class OC {
}
}
+
if (OC::$CLI) {
OC::$WEBROOT = OC_Config::getValue('overwritewebroot', '');
} else {