diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-07-07 15:01:02 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-07-07 15:08:46 +0200 |
commit | 5d3e1bc023d48bc080fa0a65dad120b7e2530867 (patch) | |
tree | 8769230bf4c806ec8af0be2e2e9aa83f67bd484a /lib | |
parent | e8537afd60d2c5d37e48a99aca9e72394cc044dd (diff) | |
download | nextcloud-server-5d3e1bc023d48bc080fa0a65dad120b7e2530867.tar.gz nextcloud-server-5d3e1bc023d48bc080fa0a65dad120b7e2530867.zip |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php index b526840a97d..840d9044711 100644 --- a/lib/base.php +++ b/lib/base.php @@ -117,10 +117,18 @@ 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] !== '/') { - OC::$WEBROOT = '/' . OC::$WEBROOT; + 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 |