diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2017-02-03 18:24:53 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-28 10:35:36 +0300 |
commit | 43427e26d78123e66652741d960c14cf40342715 (patch) | |
tree | 411718cd0fb932c2fce38fb6dc879bcdbad12144 /core/Command/Db/ConvertMysqlToMB4.php | |
parent | 6d93cb74888ae0da0d2286ca1cd82179ea367513 (diff) |
Add console command to migrate the charset
Diffstat (limited to 'core/Command/Db/ConvertMysqlToMB4.php')
-rw-r--r-- | core/Command/Db/ConvertMysqlToMB4.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index 286274753ee..38aff8b09d8 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -22,6 +22,7 @@ namespace OC\Core\Command\Db; use Doctrine\DBAL\Platforms\MySqlPlatform; +use OC\DB\MySqlTools; use OC\Migration\ConsoleOutput; use OC\Repair\Collation; use OCP\IConfig; @@ -71,18 +72,17 @@ 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()) { + $tools = new MySqlTools(); + if (!$tools->supports4ByteCharset($this->connection)) { $url = $this->urlGenerator->linkToDocs('admin-mysql-utf8mb4'); $output->writeln("The database is not properly setup to use the charset utf8mb4."); $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)); |