diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-10-14 09:16:31 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-10-14 09:16:31 +0200 |
commit | c2cfeea8889472bb06e0f64f235907165a5d5b6b (patch) | |
tree | e20e6a60dd99516962aaf118b5d19f6258cb9732 | |
parent | 526abf1ad6024294e88c48d66ed70dedb080d8e9 (diff) | |
parent | 0407bc097895355b90bc722e8b58afb27a40d538 (diff) | |
download | nextcloud-server-c2cfeea8889472bb06e0f64f235907165a5d5b6b.tar.gz nextcloud-server-c2cfeea8889472bb06e0f64f235907165a5d5b6b.zip |
Merge pull request #11534 from owncloud/issue/11500
Issue/11500 Do not set overwrite* settings by default
-rwxr-xr-x | config/config.sample.php | 7 | ||||
-rw-r--r-- | lib/private/setup.php | 2 | ||||
-rw-r--r-- | lib/private/urlgenerator.php | 4 |
3 files changed, 12 insertions, 1 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 02958ace0c2..0a21978ba2b 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -330,6 +330,13 @@ $CONFIG = array( 'overwritecondaddr' => '', /** + * Use this configuration parameter to specify the base url for any urls which are + * generated within ownCloud using any kind of command line tools (cron or occ). + * The value should contain the full base URL: ``https://www.example.com/owncloud`` + */ +'overwrite.cli.url' => '', + +/** * The URL of your proxy server, for example ``proxy.example.com:8081``. */ 'proxy' => '', diff --git a/lib/private/setup.php b/lib/private/setup.php index b1b3388f81b..75dc1987ee6 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -86,7 +86,7 @@ class OC_Setup { //write the config file \OC::$server->getConfig()->setSystemValue('trusted_domains', $trustedDomains); \OC::$server->getConfig()->setSystemValue('datadirectory', $datadir); - \OC::$server->getConfig()->setSystemValue('overwritewebroot', OC::$WEBROOT); + \OC::$server->getConfig()->setSystemValue('overwrite.cli.url', \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . OC::$WEBROOT); \OC::$server->getConfig()->setSystemValue('dbtype', $dbtype); \OC::$server->getConfig()->setSystemValue('version', implode('.', OC_Util::getVersion())); diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index f5ec9803edb..e50e9eed6af 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -162,6 +162,10 @@ class URLGenerator implements IURLGenerator { public function getAbsoluteURL($url) { $separator = $url[0] === '/' ? '' : '/'; + if (\OC::$CLI && !defined('PHPUNIT_RUN')) { + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); + } + // The ownCloud web root can already be prepended. $webRoot = substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT ? '' |