initPaths: set include path before any owncloud function is called
Ensure we can find basic owncloud classes while detecting the owncloud paths in function initPaths by add OC::$SERVERROOT . '/lib' to include path before any owncloud function is called. This fix a bug with XAMPP that cannot find the class OC_Config in function OC_Request::scriptName when called from function OC_Base::initPaths.
This commit is contained in:
parent
23166aa016
commit
37e6ac9a2a
13
lib/base.php
13
lib/base.php
|
@ -125,6 +125,13 @@ class OC {
|
||||||
public static function initPaths() {
|
public static function initPaths() {
|
||||||
// calculate the root directories
|
// calculate the root directories
|
||||||
OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
|
OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
|
||||||
|
|
||||||
|
// ensure we can find OC_Config
|
||||||
|
set_include_path(
|
||||||
|
OC::$SERVERROOT . '/lib' . PATH_SEPARATOR .
|
||||||
|
get_include_path()
|
||||||
|
);
|
||||||
|
|
||||||
OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
|
OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
|
||||||
$scriptName = OC_Request::scriptName();
|
$scriptName = OC_Request::scriptName();
|
||||||
if (substr($scriptName, -1) == '/') {
|
if (substr($scriptName, -1) == '/') {
|
||||||
|
@ -144,12 +151,6 @@ class OC {
|
||||||
OC::$WEBROOT = '/' . OC::$WEBROOT;
|
OC::$WEBROOT = '/' . OC::$WEBROOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure we can find OC_Config
|
|
||||||
set_include_path(
|
|
||||||
OC::$SERVERROOT . '/lib' . PATH_SEPARATOR .
|
|
||||||
get_include_path()
|
|
||||||
);
|
|
||||||
|
|
||||||
// search the 3rdparty folder
|
// search the 3rdparty folder
|
||||||
if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') {
|
if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') {
|
||||||
OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', '');
|
OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', '');
|
||||||
|
|
Loading…
Reference in New Issue