]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added warning for trusted_domains after CLI upgrade
authorVincent Petry <pvince81@owncloud.com>
Fri, 14 Mar 2014 09:48:07 +0000 (10:48 +0100)
committerVincent Petry <pvince81@owncloud.com>
Fri, 14 Mar 2014 10:16:45 +0000 (11:16 +0100)
If trusted_domains is not set after a CLI upgrade, show a warning in the
output.

core/command/upgrade.php
lib/private/updater.php

index 128d27aa3dbd5c64f8df5904e8c91c6aa746cd30..6e5681b26df3a71fdce9c08b70861253783ff13c 100644 (file)
@@ -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(
+                               '<warning>The setting "trusted_domains" could not be ' .
+                               'set automatically by the upgrade script, ' .
+                               'please set it manually</warning>'
+                       );
+               }
+       }
 }
index fd2d46a1fac5f446a40cd864919d3929e4bf5ede..dd8dc84e80423ab302879d67eb81506f3a929cf8 100644 (file)
@@ -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())));