From 1a116828cf00b434c5d3f5a3948393a714899df9 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 14 Mar 2014 10:48:07 +0100 Subject: [PATCH] Added warning for trusted_domains after CLI upgrade If trusted_domains is not set after a CLI upgrade, show a warning in the output. --- 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 128d27aa3d..6e5681b26d 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -27,6 +27,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; @@ -69,6 +75,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 @@ -84,4 +93,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( + 'The setting "trusted_domains" could not be ' . + 'set automatically by the upgrade script, ' . + 'please set it manually' + ); + } + } } diff --git a/lib/private/updater.php b/lib/private/updater.php index fd2d46a1fa..dd8dc84e80 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($currentVersion, '6.90.1', '<')) { + if (!\OC::$CLI && version_compare($currentVersion, '6.90.1', '<')) { // 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())));