diff options
author | Robert Ros <robert@robertros.nl> | 2014-09-18 21:33:22 +0200 |
---|---|---|
committer | Robert Ros <robert@robertros.nl> | 2014-09-18 22:29:22 +0200 |
commit | b668db242de35f13de0b317ceaa209574458e9c8 (patch) | |
tree | bb6cf02a2049f25a67645161f32d3fb05aa2bccd /install | |
parent | a15108e65b12ceaf50821783bcaa1ee3fee10d13 (diff) | |
download | wallabag-b668db242de35f13de0b317ceaa209574458e9c8.tar.gz wallabag-b668db242de35f13de0b317ceaa209574458e9c8.tar.zst wallabag-b668db242de35f13de0b317ceaa209574458e9c8.zip |
Convert the MySQL charset to utf8mb4 to support the full range of unicode characters
Diffstat (limited to 'install')
-rwxr-xr-x | install/index.php | 6 | ||||
-rw-r--r-- | install/mysql.sql | 12 |
2 files changed, 10 insertions, 8 deletions
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'])) { | |||
101 | $content = file_get_contents('inc/poche/config.inc.php'); | 101 | $content = file_get_contents('inc/poche/config.inc.php'); |
102 | 102 | ||
103 | if ($_POST['db_engine'] == 'mysql') { | 103 | if ($_POST['db_engine'] == 'mysql') { |
104 | $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database']; | 104 | $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database'] . ';charset=utf8mb4'; |
105 | $content = str_replace("define ('STORAGE_SERVER', 'localhost');", "define ('STORAGE_SERVER', '".$_POST['mysql_server']."');", $content); | 105 | $content = str_replace("define ('STORAGE_SERVER', 'localhost');", "define ('STORAGE_SERVER', '".$_POST['mysql_server']."');", $content); |
106 | $content = str_replace("define ('STORAGE_DB', 'poche');", "define ('STORAGE_DB', '".$_POST['mysql_database']."');", $content); | 106 | $content = str_replace("define ('STORAGE_DB', 'poche');", "define ('STORAGE_DB', '".$_POST['mysql_database']."');", $content); |
107 | $content = str_replace("define ('STORAGE_USER', 'poche');", "define ('STORAGE_USER', '".$_POST['mysql_user']."');", $content); | 107 | $content = str_replace("define ('STORAGE_USER', 'poche');", "define ('STORAGE_USER', '".$_POST['mysql_user']."');", $content); |
108 | $content = str_replace("define ('STORAGE_PASSWORD', 'poche');", "define ('STORAGE_PASSWORD', '".$_POST['mysql_password']."');", $content); | 108 | $content = str_replace("define ('STORAGE_PASSWORD', 'poche');", "define ('STORAGE_PASSWORD', '".$_POST['mysql_password']."');", $content); |
109 | $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']); | 109 | $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password'], array( |
110 | PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', | ||
111 | )); | ||
110 | 112 | ||
111 | $sql_structure = file_get_contents('install/mysql.sql'); | 113 | $sql_structure = file_get_contents('install/mysql.sql'); |
112 | } | 114 | } |
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` ( | |||
3 | `name` varchar(255) NOT NULL, | 3 | `name` varchar(255) NOT NULL, |
4 | `value` varchar(255) NOT NULL, | 4 | `value` varchar(255) NOT NULL, |
5 | PRIMARY KEY (`id`) | 5 | PRIMARY KEY (`id`) |
6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
7 | 7 | ||
8 | CREATE TABLE IF NOT EXISTS `entries` ( | 8 | CREATE TABLE IF NOT EXISTS `entries` ( |
9 | `id` int(11) NOT NULL AUTO_INCREMENT, | 9 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `entries` ( | |||
14 | `content` blob NOT NULL, | 14 | `content` blob NOT NULL, |
15 | `user_id` int(11) NOT NULL, | 15 | `user_id` int(11) NOT NULL, |
16 | PRIMARY KEY (`id`) | 16 | PRIMARY KEY (`id`) |
17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
18 | 18 | ||
19 | CREATE TABLE IF NOT EXISTS `users` ( | 19 | CREATE TABLE IF NOT EXISTS `users` ( |
20 | `id` int(11) NOT NULL AUTO_INCREMENT, | 20 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS `users` ( | |||
23 | `name` varchar(255) NOT NULL, | 23 | `name` varchar(255) NOT NULL, |
24 | `email` varchar(255) NOT NULL, | 24 | `email` varchar(255) NOT NULL, |
25 | PRIMARY KEY (`id`) | 25 | PRIMARY KEY (`id`) |
26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
27 | 27 | ||
28 | CREATE TABLE IF NOT EXISTS `users_config` ( | 28 | CREATE TABLE IF NOT EXISTS `users_config` ( |
29 | `id` int(11) NOT NULL AUTO_INCREMENT, | 29 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -31,13 +31,13 @@ CREATE TABLE IF NOT EXISTS `users_config` ( | |||
31 | `name` varchar(255) NOT NULL, | 31 | `name` varchar(255) NOT NULL, |
32 | `value` varchar(255) NOT NULL, | 32 | `value` varchar(255) NOT NULL, |
33 | PRIMARY KEY (`id`) | 33 | PRIMARY KEY (`id`) |
34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
35 | 35 | ||
36 | CREATE TABLE IF NOT EXISTS `tags` ( | 36 | CREATE TABLE IF NOT EXISTS `tags` ( |
37 | `id` int(11) NOT NULL AUTO_INCREMENT, | 37 | `id` int(11) NOT NULL AUTO_INCREMENT, |
38 | `value` varchar(255) NOT NULL, | 38 | `value` varchar(255) NOT NULL, |
39 | PRIMARY KEY (`id`) | 39 | PRIMARY KEY (`id`) |
40 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 40 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
41 | 41 | ||
42 | CREATE TABLE IF NOT EXISTS `tags_entries` ( | 42 | CREATE TABLE IF NOT EXISTS `tags_entries` ( |
43 | `id` int(11) NOT NULL AUTO_INCREMENT, | 43 | `id` int(11) NOT NULL AUTO_INCREMENT, |
@@ -46,4 +46,4 @@ CREATE TABLE IF NOT EXISTS `tags_entries` ( | |||
46 | FOREIGN KEY(entry_id) REFERENCES entries(id) ON DELETE CASCADE, | 46 | FOREIGN KEY(entry_id) REFERENCES entries(id) ON DELETE CASCADE, |
47 | FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, | 47 | FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, |
48 | PRIMARY KEY (`id`) | 48 | PRIMARY KEY (`id`) |
49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |