diff --git a/code/web/private_php/ams/plugins/API_key_management/API_key_management.php b/code/web/private_php/ams/plugins/API_key_management/API_key_management.php index b8dc965fc..f7caef90e 100644 --- a/code/web/private_php/ams/plugins/API_key_management/API_key_management.php +++ b/code/web/private_php/ams/plugins/API_key_management/API_key_management.php @@ -92,17 +92,17 @@ function api_key_management_hook_activate() CREATE TABLE IF NOT EXISTS `ams_api_keys` ( `SNo` int(10) NOT NULL AUTO_INCREMENT, - `User` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `FrName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `UserType` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `UserCharacter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `User` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `FrName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `UserType` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `UserCharacter` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ExpiryDate` date DEFAULT NULL, - `AccessToken` text COLLATE utf8_unicode_ci DEFAULT NULL, + `AccessToken` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, `AddedOn` datetime DEFAULT NULL, - `Items` text COLLATE utf8_unicode_ci, + `Items` text COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`SNo`), KEY `User` (`User`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ; -- -- Constraints for table `ams_api_keys` diff --git a/code/web/private_php/ams/plugins/resource.mysql.php b/code/web/private_php/ams/plugins/resource.mysql.php index 312f3fc73..4af19756d 100644 --- a/code/web/private_php/ams/plugins/resource.mysql.php +++ b/code/web/private_php/ams/plugins/resource.mysql.php @@ -12,7 +12,7 @@ * `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, * `source` text, * PRIMARY KEY (`name`) - * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; * * Demo data: *
INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');
diff --git a/code/web/private_php/ams/plugins/resource.mysqls.php b/code/web/private_php/ams/plugins/resource.mysqls.php index f9fe1c2f2..f7c4a663d 100644 --- a/code/web/private_php/ams/plugins/resource.mysqls.php +++ b/code/web/private_php/ams/plugins/resource.mysqls.php @@ -15,7 +15,7 @@ * `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, * `source` text, * PRIMARY KEY (`name`) - * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; * * Demo data: *
INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');
diff --git a/code/web/public_php/api/common/db_lib.php b/code/web/public_php/api/common/db_lib.php index 5d054b1bb..cedd6431b 100644 --- a/code/web/public_php/api/common/db_lib.php +++ b/code/web/public_php/api/common/db_lib.php @@ -134,7 +134,7 @@ class ryDB { global $_RYZOM_API_CONFIG; $this->db_name = $db_name; $this->db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $db_name); - $this->db->query("SET NAMES utf8"); + $this->db->query("SET NAMES utf8mb4"); } public static function getInstance($db_name) { @@ -480,7 +480,7 @@ class ryDB { $c = "Updating DB Structure...\n"; foreach ($defs as $dbname => $tables) { $db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $dbname); - $db->query("SET NAMES utf8"); + $db->query("SET NAMES utf8mb4"); $c .= "\n Selected DB '$dbname'\n"; foreach ($tables as $table => $sql) { diff --git a/code/web/public_php/setup/header.php b/code/web/public_php/setup/header.php index bc3924f4a..cefc30a01 100644 --- a/code/web/public_php/setup/header.php +++ b/code/web/public_php/setup/header.php @@ -62,7 +62,7 @@ function validate_writable($continue, $path) { function create_use_database($continue_r, $con, $database) { $continue = $continue_r; if ($continue) { - $sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"; + $sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"; if (mysqli_query($con, $sql)) { printalert("success", "Database " . $database . " created"); } else { diff --git a/code/web/public_php/webtt/app/config/database.php b/code/web/public_php/webtt/app/config/database.php index 3119752d2..702ece282 100644 --- a/code/web/public_php/webtt/app/config/database.php +++ b/code/web/public_php/webtt/app/config/database.php @@ -8,7 +8,7 @@ class DATABASE_CONFIG { 'login' => 'webtt', 'password' => 'webtt77', 'database' => 'webtt2', - 'encoding' => 'utf8' + 'encoding' => 'utf8mb4' ); var $raw_files = array( 'datasource' => 'RawFilesSource', diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/model/cake_schema.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/model/cake_schema.test.php index 2b3abcc8b..5ae80c83e 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/model/cake_schema.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/model/cake_schema.test.php @@ -872,8 +872,8 @@ class CakeSchemaTest extends CakeTestCase { 'author_id' => array('column' => 'author_id'), ), 'tableParameters' => array( - 'charset' => 'utf8', - 'collate' => 'utf8_general_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci', 'engine' => 'MyISAM' ) ), @@ -885,8 +885,8 @@ class CakeSchemaTest extends CakeTestCase { 'PRIMARY' => array('column' => 'id', 'unique' => true), ), 'tableParameters' => array( - 'charset' => 'utf8', - 'collate' => 'utf8_general_ci' + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci' ) ) ); @@ -898,8 +898,8 @@ class CakeSchemaTest extends CakeTestCase { ), 'change' => array( 'tableParameters' => array( - 'charset' => 'utf8', - 'collate' => 'utf8_general_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci', 'engine' => 'MyISAM' ) ) @@ -910,8 +910,8 @@ class CakeSchemaTest extends CakeTestCase { ), 'change' => array( 'tableParameters' => array( - 'charset' => 'utf8', - 'collate' => 'utf8_general_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci', ) ) ) diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index c90d585ca..30bf9555c 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -376,11 +376,11 @@ class DboMysqlTest extends CakeTestCase { 'default', 'null' => true, 'key', - 'charset' => 'utf8', - 'collate' => 'utf8_unicode_ci' + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_unicode_ci' ); $result = $this->db->buildColumn($data); - $expected = '`testName` CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL'; + $expected = '`testName` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL'; $this->assertEqual($result, $expected); $this->db->columns = $restore; } @@ -648,22 +648,22 @@ class DboMysqlTest extends CakeTestCase { 'id' => array('type' => 'integer', 'null' => false, 'default' => 0), 'name' => array('type' => 'string', 'null' => false, 'length' => 50), 'tableParameters' => array( - 'charset' => 'utf8', - 'collate' => 'utf8_general_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci', 'engine' => 'InnoDB' ) ) )); $result = $this->db->alterSchema($schema2->compare($schema1)); - $this->assertPattern('/DEFAULT CHARSET=utf8/', $result); + $this->assertPattern('/DEFAULT CHARSET=utf8mb4/', $result); $this->assertPattern('/ENGINE=InnoDB/', $result); - $this->assertPattern('/COLLATE=utf8_general_ci/', $result); + $this->assertPattern('/COLLATE=utf8mb4_general_ci/', $result); $this->db->query($result); $result = $this->db->listDetailedSources('altertest'); - $this->assertEqual($result['Collation'], 'utf8_general_ci'); + $this->assertEqual($result['Collation'], 'utf8mb4_general_ci'); $this->assertEqual($result['Engine'], 'InnoDB'); - $this->assertEqual($result['charset'], 'utf8'); + $this->assertEqual($result['charset'], 'utf8mb4'); $this->db->query($this->db->dropSchema($schema1)); } @@ -710,11 +710,11 @@ class DboMysqlTest extends CakeTestCase { */ function testReadTableParameters() { $this->db->cacheSources = false; - $this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;'); + $this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'); $result = $this->db->readTableParameters('tinyint'); $expected = array( - 'charset' => 'utf8', - 'collate' => 'utf8_unicode_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_unicode_ci', 'engine' => 'InnoDB'); $this->assertEqual($result, $expected); @@ -738,13 +738,13 @@ class DboMysqlTest extends CakeTestCase { function testBuildTableParameters() { $this->db->cacheSources = false; $data = array( - 'charset' => 'utf8', - 'collate' => 'utf8_unicode_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_unicode_ci', 'engine' => 'InnoDB'); $result = $this->db->buildTableParameters($data); $expected = array( - 'DEFAULT CHARSET=utf8', - 'COLLATE=utf8_unicode_ci', + 'DEFAULT CHARSET=utf8mb4', + 'COLLATE=utf8mb4_unicode_ci', 'ENGINE=InnoDB'); $this->assertEqual($result, $expected); } @@ -757,8 +757,8 @@ class DboMysqlTest extends CakeTestCase { */ function testGetCharsetName() { $this->db->cacheSources = false; - $result = $this->db->getCharsetName('utf8_unicode_ci'); - $this->assertEqual($result, 'utf8'); + $result = $this->db->getCharsetName('utf8mb4_unicode_ci'); + $this->assertEqual($result, 'utf8mb4'); $result = $this->db->getCharsetName('cp1250_general_ci'); $this->assertEqual($result, 'cp1250'); } diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php index e3a94512b..812e33216 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php @@ -318,11 +318,11 @@ class DboMysqliTest extends CakeTestCase { */ function testReadTableParameters() { $this->db->cacheSources = $this->db->testing = false; - $this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;'); + $this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'); $result = $this->db->readTableParameters('tinyint'); $expected = array( - 'charset' => 'utf8', - 'collate' => 'utf8_unicode_ci', + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_unicode_ci', 'engine' => 'InnoDB'); $this->assertEqual($result, $expected);