From b668db242de35f13de0b317ceaa209574458e9c8 Mon Sep 17 00:00:00 2001 From: Robert Ros Date: Thu, 18 Sep 2014 21:33:22 +0200 Subject: Convert the MySQL charset to utf8mb4 to support the full range of unicode characters --- install/index.php | 6 ++++-- install/mysql.sql | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'install') diff --git a/install/index.php b/install/index.php index 1ae782a2..2b080c16 100755 --- a/install/index.php +++ b/install/index.php @@ -101,12 +101,14 @@ else if (isset($_POST['install'])) { $content = file_get_contents('inc/poche/config.inc.php'); if ($_POST['db_engine'] == 'mysql') { - $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database']; + $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database'] . ';charset=utf8mb4'; $content = str_replace("define ('STORAGE_SERVER', 'localhost');", "define ('STORAGE_SERVER', '".$_POST['mysql_server']."');", $content); $content = str_replace("define ('STORAGE_DB', 'poche');", "define ('STORAGE_DB', '".$_POST['mysql_database']."');", $content); $content = str_replace("define ('STORAGE_USER', 'poche');", "define ('STORAGE_USER', '".$_POST['mysql_user']."');", $content); $content = str_replace("define ('STORAGE_PASSWORD', 'poche');", "define ('STORAGE_PASSWORD', '".$_POST['mysql_password']."');", $content); - $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']); + $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password'], array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', + )); $sql_structure = file_get_contents('install/mysql.sql'); } diff --git a/install/mysql.sql b/install/mysql.sql index de5640e4..1b65cd35 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS `config` ( `name` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `entries` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `entries` ( `content` blob NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS `users` ( `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `users_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -31,13 +31,13 @@ CREATE TABLE IF NOT EXISTS `users_config` ( `name` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `tags` ( `id` int(11) NOT NULL AUTO_INCREMENT, `value` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `tags_entries` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -46,4 +46,4 @@ CREATE TABLE IF NOT EXISTS `tags_entries` ( FOREIGN KEY(entry_id) REFERENCES entries(id) ON DELETE CASCADE, FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- cgit v1.2.3 From fcd37d0c7b83fda1684651d890e82edded0f420e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 29 Oct 2014 21:02:07 +0100 Subject: change type for password field in installation --- install/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'install') diff --git a/install/index.php b/install/index.php index b27200a8..fee063bb 100755 --- a/install/index.php +++ b/install/index.php @@ -290,7 +290,7 @@ php composer.phar install
  • -
  • +
  • @@ -299,7 +299,7 @@ php composer.phar install
  • -
  • +
  • -- cgit v1.2.3