diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-30 13:57:04 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-10-19 00:15:01 +0200 |
commit | cc28f82b369c2e8ebf2d0b4390379b9cda4af40b (patch) | |
tree | 3681f1e92af5a4bc0c581d3314e5cb37b00dd63a /lib/private/Setup | |
parent | 972e560e7274cf25021b1a5095206640b063789a (diff) | |
download | nextcloud-server-cc28f82b369c2e8ebf2d0b4390379b9cda4af40b.tar.gz nextcloud-server-cc28f82b369c2e8ebf2d0b4390379b9cda4af40b.zip |
Add config option to update charset of mysql to utf8mb4
* fully optional
* requires additional options set in the database
Diffstat (limited to 'lib/private/Setup')
-rw-r--r-- | lib/private/Setup/MySQL.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 4ad6926c2d7..c022616d8b3 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -58,8 +58,9 @@ class MySQL extends AbstractDatabase { try{ $name = $this->dbName; $user = $this->dbUser; - //we can't use OC_BD functions here because we need to connect as the administrative user. - $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET utf8 COLLATE utf8_bin;"; + //we can't use OC_DB functions here because we need to connect as the administrative user. + $characterSet = \OC::$server->getSystemConfig()->getValue('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; + $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE ${characterSet}_bin;"; $connection->executeUpdate($query); } catch (\Exception $ex) { $this->logger->error('Database creation failed: {error}', [ |