diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-07-07 17:37:35 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-08 15:12:07 +0200 |
commit | 76c709d7de67f680b3f1f8b52f0418e029d99341 (patch) | |
tree | 2b81311c0dcc991781503775de8a134671548e30 /lib/private | |
parent | 687cd7fe83fc40d7bc7d2ba7df5b495bf7bebdca (diff) | |
download | nextcloud-server-76c709d7de67f680b3f1f8b52f0418e029d99341.tar.gz nextcloud-server-76c709d7de67f680b3f1f8b52f0418e029d99341.zip |
Add repair step to set MySQL collation to utf8_bin
Set default collation of mysql connection to utf8_bin
Set utf_bin as default collation for new tables
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/db/mdb2schemareader.php | 1 | ||||
-rw-r--r-- | lib/private/repair.php | 3 | ||||
-rw-r--r-- | lib/private/setup/mysql.php | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php index 61f58a1f200..288eef5cda0 100644 --- a/lib/private/db/mdb2schemareader.php +++ b/lib/private/db/mdb2schemareader.php @@ -82,6 +82,7 @@ class MDB2SchemaReader { $name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name); $name = $this->platform->quoteIdentifier($name); $table = $schema->createTable($name); + $table->addOption('collate', 'utf8_bin'); break; case 'create': case 'overwrite': diff --git a/lib/private/repair.php b/lib/private/repair.php index 89886dd9316..e6943c5d057 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -81,7 +81,8 @@ class Repair extends BasicEmitter { */ public static function getBeforeUpgradeRepairSteps() { return array( - new \OC\Repair\InnoDB() + new \OC\Repair\InnoDB(), + new \OC\Repair\Collation(\OC::$server->getConfig(), \OC_DB::getConnection()) ); } diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php index b2c28173b1c..3327965fb49 100644 --- a/lib/private/setup/mysql.php +++ b/lib/private/setup/mysql.php @@ -61,7 +61,7 @@ class MySQL extends AbstractDatabase { $name = $this->dbname; $user = $this->dbuser; //we cant use OC_BD functions here because we need to connect as the administrative user. - $query = "CREATE DATABASE IF NOT EXISTS `$name`"; + $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET utf8 COLLATE utf8_bin;"; $result = mysql_query($query, $connection); if(!$result) { $entry = $this->trans->t('DB Error: "%s"', array(mysql_error($connection))) . '<br />'; |