forked from GithubBackups/tinyib
Change charset from utf8 to utf8mb4
This commit is contained in:
parent
68012f8c31
commit
dbe4e1ec29
36
imgboard.php
36
imgboard.php
@ -135,22 +135,22 @@ if (TINYIB_DBMODE == 'pdo' && TINYIB_DBDRIVER == 'pgsql') {
|
|||||||
`parent` mediumint(7) unsigned NOT NULL,
|
`parent` mediumint(7) unsigned NOT NULL,
|
||||||
`timestamp` int(20) NOT NULL,
|
`timestamp` int(20) NOT NULL,
|
||||||
`bumped` int(20) NOT NULL,
|
`bumped` int(20) NOT NULL,
|
||||||
`ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`name` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`name` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`tripcode` varchar(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`tripcode` varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`email` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`email` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`nameblock` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`nameblock` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`subject` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`subject` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`message` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`file` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`file` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`file_hex` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`file_hex` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`file_original` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`file_original` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`file_size` int(20) unsigned NOT NULL default '0',
|
`file_size` int(20) unsigned NOT NULL default '0',
|
||||||
`file_size_formatted` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`file_size_formatted` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`image_width` smallint(5) unsigned NOT NULL default '0',
|
`image_width` smallint(5) unsigned NOT NULL default '0',
|
||||||
`image_height` smallint(5) unsigned NOT NULL default '0',
|
`image_height` smallint(5) unsigned NOT NULL default '0',
|
||||||
`thumb` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`thumb` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`thumb_width` smallint(5) unsigned NOT NULL default '0',
|
`thumb_width` smallint(5) unsigned NOT NULL default '0',
|
||||||
`thumb_height` smallint(5) unsigned NOT NULL default '0',
|
`thumb_height` smallint(5) unsigned NOT NULL default '0',
|
||||||
`stickied` tinyint(1) NOT NULL default '0',
|
`stickied` tinyint(1) NOT NULL default '0',
|
||||||
@ -164,25 +164,25 @@ if (TINYIB_DBMODE == 'pdo' && TINYIB_DBDRIVER == 'pgsql') {
|
|||||||
|
|
||||||
$bans_sql = "CREATE TABLE `" . TINYIB_DBBANS . "` (
|
$bans_sql = "CREATE TABLE `" . TINYIB_DBBANS . "` (
|
||||||
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
||||||
`ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`timestamp` int(20) NOT NULL,
|
`timestamp` int(20) NOT NULL,
|
||||||
`expire` int(20) NOT NULL,
|
`expire` int(20) NOT NULL,
|
||||||
`reason` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `ip` (`ip`)
|
KEY `ip` (`ip`)
|
||||||
)";
|
)";
|
||||||
|
|
||||||
$reports_sql = "CREATE TABLE `" . TINYIB_DBREPORTS . "` (
|
$reports_sql = "CREATE TABLE `" . TINYIB_DBREPORTS . "` (
|
||||||
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
||||||
`ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`post` int(20) NOT NULL,
|
`post` int(20) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
)";
|
)";
|
||||||
|
|
||||||
$keywords_sql = "CREATE TABLE `" . TINYIB_DBKEYWORDS . "` (
|
$keywords_sql = "CREATE TABLE `" . TINYIB_DBKEYWORDS . "` (
|
||||||
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
`id` mediumint(7) unsigned NOT NULL auto_increment,
|
||||||
`text` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`text` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`action` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
`action` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ $db_selected = mysql_select_db(TINYIB_DBNAME, $link);
|
|||||||
if (!$db_selected) {
|
if (!$db_selected) {
|
||||||
fancyDie("Could not select database: " . mysql_error());
|
fancyDie("Could not select database: " . mysql_error());
|
||||||
}
|
}
|
||||||
mysql_query("SET NAMES 'utf8'");
|
mysql_query("SET NAMES 'utf8mb4'");
|
||||||
|
|
||||||
// Create the posts table if it does not exist
|
// Create the posts table if it does not exist
|
||||||
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
|
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
|
||||||
|
@ -15,7 +15,7 @@ $db_selected = @mysqli_query($link, "USE " . TINYIB_DBNAME);
|
|||||||
if (!$db_selected) {
|
if (!$db_selected) {
|
||||||
fancyDie("Could not select database: " . ((is_object($link)) ? mysqli_error($link) : (($link_error = mysqli_connect_error()) ? $link_error : '(unknown error')));
|
fancyDie("Could not select database: " . ((is_object($link)) ? mysqli_error($link) : (($link_error = mysqli_connect_error()) ? $link_error : '(unknown error')));
|
||||||
}
|
}
|
||||||
mysqli_query($link, "SET NAMES 'utf8'");
|
mysqli_query($link, "SET NAMES 'utf8mb4'");
|
||||||
|
|
||||||
// Create the posts table if it does not exist
|
// Create the posts table if it does not exist
|
||||||
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
|
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
|
||||||
|
@ -19,7 +19,7 @@ if (TINYIB_DBDRIVER === 'pgsql') {
|
|||||||
} else {
|
} else {
|
||||||
$options = array(PDO::ATTR_PERSISTENT => true,
|
$options = array(PDO::ATTR_PERSISTENT => true,
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user