[Pkg-owncloud-commits] [owncloud] 74/129: Use IRequest's `getScriptName` functionality instead of $_SERVER['SCRIPT_NAME']
David Prévot
taffit at moszumanska.debian.org
Thu Nov 5 01:04:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 4035bcf26aefd53cf39e666e220c8958945ff728
Author: Lukas Reschke <lukas at owncloud.com>
Date: Wed Oct 21 17:33:49 2015 +0200
Use IRequest's `getScriptName` functionality instead of $_SERVER['SCRIPT_NAME']
---
lib/base.php | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/base.php b/lib/base.php
index 5deba78..065a9f8 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 {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list