Skip to content

Commit

Permalink
UTF-8 Multibyte (utf8mb4) support
Browse files Browse the repository at this point in the history
When utf8mb4 is not supported do not run the CONVERT TO CHARACTER SET database queries (they have no effect, just waste time)
  • Loading branch information
Nicholas K. Dionysopoulos committed Jun 13, 2015
1 parent 73b7f87 commit fa7d82d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions installation/model/database.php
Expand Up @@ -904,6 +904,15 @@ public function populateDatabase($db, $schema)
*/
$query = $db->convertUtf8mb4QueryToUtf8($query);

/**
* This is a query which was supposed to convert tables to utf8mb4 charset but the server doesn't
* support utf8mb4. Therefore we don't have to run it, it has no effect and it's a mere waste of time.
*/
if (!$db->hasUTF8mb4Support() && stristr($query, 'CONVERT TO CHARACTER SET utf8 '))
{
continue;
}

// Execute the query.
$db->setQuery($query);

Expand Down
9 changes: 9 additions & 0 deletions libraries/cms/installer/installer.php
Expand Up @@ -953,6 +953,15 @@ public function parseSQLFiles($element)
*/
$query = $db->convertUtf8mb4QueryToUtf8($query);

/**
* This is a query which was supposed to convert tables to utf8mb4 charset but the server doesn't
* support utf8mb4. Therefore we don't have to run it, it has no effect and it's a mere waste of time.
*/
if (!$db->hasUTF8mb4Support() && stristr($query, 'CONVERT TO CHARACTER SET utf8 '))
{
continue;
}

$db->setQuery($query);

if (!$db->execute())
Expand Down

0 comments on commit fa7d82d

Please sign in to comment.