Browse Source

Set overwritemailurl* configs on setup

Correctly use overwritemailurl value when generating absolute urls in CLI

Fix #11500

Rename the config to *cli

Add overwrite.cli.url to the sample config

Revert separator fix, fixes unit test
tags/v8.0.0alpha1
Joas Schilling 9 years ago
parent
commit
0407bc0978
3 changed files with 12 additions and 1 deletions
  1. 7
    0
      config/config.sample.php
  2. 1
    1
      lib/private/setup.php
  3. 4
    0
      lib/private/urlgenerator.php

+ 7
- 0
config/config.sample.php View File

@@ -329,6 +329,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``.
*/

+ 1
- 1
lib/private/setup.php View File

@@ -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()));


+ 4
- 0
lib/private/urlgenerator.php View File

@@ -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
? ''

Loading…
Cancel
Save