Only calculate the WEBROOT from scriptName if it contains $SUBURI
If not we are most likely in CLI mode. However to be able to still generate valid URLs, we need to use the overwrite webroot instead. Fix #9490
This commit is contained in:
parent
e8537afd60
commit
5d3e1bc023
12
lib/base.php
12
lib/base.php
|
@ -117,11 +117,19 @@ class OC {
|
|||
}
|
||||
}
|
||||
|
||||
OC::$WEBROOT = substr($scriptName, 0, strlen($scriptName) - strlen(OC::$SUBURI));
|
||||
if (substr($scriptName, 0 - strlen(OC::$SUBURI)) === OC::$SUBURI) {
|
||||
OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
|
||||
|
||||
if (OC::$WEBROOT != '' and OC::$WEBROOT[0] !== '/') {
|
||||
if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
|
||||
OC::$WEBROOT = '/' . OC::$WEBROOT;
|
||||
}
|
||||
} else {
|
||||
// The scriptName is not ending with OC::$SUBURI
|
||||
// This most likely means that we are calling from CLI.
|
||||
// However some cron jobs still need to generate
|
||||
// a web URL, so we use overwritewebroot as a fallback.
|
||||
OC::$WEBROOT = OC_Config::getValue('overwritewebroot', '');
|
||||
}
|
||||
|
||||
// search the 3rdparty folder
|
||||
if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') {
|
||||
|
|
Loading…
Reference in New Issue