]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve error message of charset convert script and behaviour 3928/head
authorMorris Jobke <hey@morrisjobke.de>
Thu, 23 Mar 2017 21:36:22 +0000 (15:36 -0600)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 23 Mar 2017 21:36:22 +0000 (15:36 -0600)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
core/Command/Db/ConvertMysqlToMB4.php

index 5302b3cf5fbded79ee9d6a1d102e3325bca772d9..286274753eefe67fdecab099896e626e150a40a2 100644 (file)
@@ -71,17 +71,18 @@ class ConvertMysqlToMB4 extends Command {
                        return 1;
                }
 
+               $oldValue = $this->config->getSystemValue('mysql.utf8mb4', false);
+               // enable charset
+               $this->config->setSystemValue('mysql.utf8mb4', true);
+
                if (!$this->connection->supports4ByteText()) {
                        $url = $this->urlGenerator->linkToDocs('admin-mysql-utf8mb4');
                        $output->writeln("The database is not properly setup to use the charset utf8mb4.");
-                       $output->writeln("Also check that the setting 'mysql.utf8mb4' is set to true in the config.php.");
                        $output->writeln("For more information please read the documentation at $url");
+                       $this->config->setSystemValue('mysql.utf8mb4', $oldValue);
                        return 1;
                }
 
-               // enable charset
-               $this->config->setSystemValue('mysql.utf8mb4', true);
-
                // run conversion
                $coll = new Collation($this->config, $this->logger, $this->connection, false);
                $coll->run(new ConsoleOutput($output));