[Pkg-owncloud-commits] [owncloud] 55/134: Added warning for trusted_domains after CLI upgrade

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 21:44:00 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 58db31e61e2987390e879fd1a2e31cad8563af76
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Mar 17 14:21:00 2014 +0100

    Added warning for trusted_domains after CLI upgrade
    
    If trusted_domains is not set after a CLI upgrade, show a warning in the
    output.
    
    Backport of 1a11682 from master
---
 core/command/upgrade.php | 26 ++++++++++++++++++++++++++
 lib/private/updater.php  |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index 1d105b6..65d3e0b 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -29,6 +29,12 @@ class Upgrade extends Command {
 		;
 	}
 
+	/**
+	 * Execute the upgrade command
+	 *
+	 * @param InputInterface $input input interface
+	 * @param OutputInterface $output output interface
+	 */
 	protected function execute(InputInterface $input, OutputInterface $output) {
 		global $RUNTIME_NOAPPS;
 
@@ -71,6 +77,9 @@ class Upgrade extends Command {
 			});
 
 			$updater->upgrade();
+
+			$this->postUpgradeCheck($input, $output);
+
 			return self::ERROR_SUCCESS;
 		} else if(\OC_Config::getValue('maintenance', false)) {
 			//Possible scenario: ownCloud core is updated but an app failed
@@ -86,4 +95,21 @@ class Upgrade extends Command {
 			return self::ERROR_UP_TO_DATE;
 		}
 	}
+
+	/**
+	 * Perform a post upgrade check (specific to the command line tool)
+	 *
+	 * @param InputInterface $input input interface
+	 * @param OutputInterface $output output interface
+	 */
+	protected function postUpgradeCheck(InputInterface $input, OutputInterface $output) {
+		$trustedDomains = \OC_Config::getValue('trusted_domains', array());
+		if (empty($trustedDomains)) {
+			$output->write(
+				'<warning>The setting "trusted_domains" could not be ' .
+				'set automatically by the upgrade script, ' .
+				'please set it manually</warning>'
+			);
+		}
+	}
 }
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 841278b..c58c12f 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -108,7 +108,7 @@ class Updater extends BasicEmitter {
 		/*
 		 * START CONFIG CHANGES FOR OLDER VERSIONS
 		 */
-		if (version_compare($installedVersion, '6.00.4', '<')) {
+		if (!\OC::$CLI && version_compare($installedVersion, '6.00.4', '<')) {
 			// Add the overwriteHost config if it is not existant
 			// This is added to prevent host header poisoning
 			\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost()))); 

-- 
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