summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {