Commit 5c8a16c5 authored by Robert Lyon's avatar Robert Lyon

Bug 1714868: Allow mysql to be utf8mb4

The changes should allow ithe install of either a utf8 or utf8mb4 site

behatnotneeded

Change-Id: I23479c50f2dc2ac197f244cf723a60e79f88c561
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 011b4b31
......@@ -1375,7 +1375,7 @@
<KEY NAME="institution" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
</KEYS>
<INDEXES>
<INDEX NAME="connectionk" UNIQUE="true" FIELDS="name,class,connection,institution" COMMENT="the connections can be repeated but the name must be unique for a given type and institution"/>
<INDEX NAME="connectionk" UNIQUE="true" FIELDS="name" COMMENT="the connections can be repeated but the name must be unique for a given type and institution"/>
</INDEXES>
</TABLE>
</TABLES>
......
......@@ -4574,7 +4574,7 @@ function xmldb_core_upgrade($oldversion=0) {
$table->addFieldInfo('isfatal', XMLDB_TYPE_INTEGER, 1, false, XMLDB_NOTNULL, null, null, null, 1);
$table->addFieldInfo('version', XMLDB_TYPE_CHAR, 255, false);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addIndexInfo('connectionk', XMLDB_INDEX_UNIQUE, array('name', 'class', 'connection', 'institution'));
$table->addIndexInfo('connectionk', XMLDB_INDEX_UNIQUE, array('name'));
$table->addKeyInfo('institution', XMLDB_KEY_FOREIGN, array('institution'), 'institution', array('name'));
create_table($table);
clear_menu_cache();
......
......@@ -77,7 +77,7 @@ function db_is_utf8() {
}
if (is_mysql()) {
$result = $db->_Execute("SHOW VARIABLES LIKE 'character_set_database'");
return $result->fields['Value'] == 'utf8';
return preg_match('/^utf8/', $result->fields['Value']);
}
if (is_postgres()) {
$result = $db->_Execute("SHOW SERVER_ENCODING");
......@@ -1538,7 +1538,7 @@ function configure_dbconnection() {
if (is_mysql()) {
$db->_Execute("SET SQL_MODE='POSTGRESQL'");
$db->_Execute("SET CHARACTER SET utf8");
$db->_Execute("SET CHARACTER SET utf8mb4");
$db->_Execute("SET SQL_BIG_SELECTS=1");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment