[Pkg-owncloud-commits] [owncloud] 13/34: Set overwritemailurl* configs on setup

David Prévot taffit at moszumanska.debian.org
Fri Oct 17 01:32:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ba33fd6a07bf55b10366b012be8d4d4e14ac7d2a
Author: Joas Schilling <nickvergessen at gmx.de>
Date:   Mon Oct 13 11:18:24 2014 +0200

    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
    
    Backport of 0407bc097895355b90bc722e8b58afb27a40d538 from master
---
 config/config.sample.php     | 7 +++++++
 lib/private/setup.php        | 2 +-
 lib/private/urlgenerator.php | 4 ++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/config/config.sample.php b/config/config.sample.php
index ffbcbea..d86d46a 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 2747922..2ad569c 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -82,7 +82,7 @@ class OC_Setup {
 		//write the config file
 		OC_Config::setValue('trusted_domains', $trustedDomains);
 		OC_Config::setValue('datadirectory', $datadir);
-		OC_Config::setValue('overwritewebroot', OC::$WEBROOT);
+		OC_Config::setValue('overwrite.cli.url', \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . OC::$WEBROOT);
 		OC_Config::setValue('dbtype', $dbtype);
 		OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
 		try {
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index af5d977..c9a567a 100644
--- a/lib/private/urlgenerator.php
+++ b/lib/private/urlgenerator.php
@@ -149,6 +149,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
 			? ''

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list