diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-10-21 17:33:49 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-10-21 17:33:49 +0200 |
commit | 23e22c52b07b963e022a17c7ee8cff19f1223484 (patch) | |
tree | fb205162b447eb382a4aa017803e2b3584722f95 | |
parent | 8133d46620efa39b74dbb216acbed82efad8c4d2 (diff) | |
download | nextcloud-server-23e22c52b07b963e022a17c7ee8cff19f1223484.tar.gz nextcloud-server-23e22c52b07b963e022a17c7ee8cff19f1223484.zip |
Use IRequest's `getScriptName` functionality instead of $_SERVER['SCRIPT_NAME']
-rw-r--r-- | lib/base.php | 14 |
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 { |