aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-10-14 19:56:50 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-10-14 19:56:50 +0200
commit5b16d508b5b3b9a981ef357b68f8b0167b3fd631 (patch)
treec66f34e10d5788551d787883f9f06b1e7f5bf417 /inc
parent05e313ad286b3dab504b5a96812132eb6cf48206 (diff)
parentb668db242de35f13de0b317ceaa209574458e9c8 (diff)
downloadwallabag-5b16d508b5b3b9a981ef357b68f8b0167b3fd631.tar.gz
wallabag-5b16d508b5b3b9a981ef357b68f8b0167b3fd631.tar.zst
wallabag-5b16d508b5b3b9a981ef357b68f8b0167b3fd631.zip
Merge pull request #843 from rros/mysql-utf8mb4
Convert the MySQL charset to utf8mb4 to support the full range of unicode
Diffstat (limited to 'inc')
-rwxr-xr-xinc/poche/Database.class.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index b5dd2120..f6ba4708 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -24,15 +24,17 @@ class Database {
24 switch (STORAGE) { 24 switch (STORAGE) {
25 case 'sqlite': 25 case 'sqlite':
26 // Check if /db is writeable 26 // Check if /db is writeable
27 if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) { 27 if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) {
28 die('An error occured: "db" directory must be writeable for your web server user!'); 28 die('An error occured: "db" directory must be writeable for your web server user!');
29 } 29 }
30 $db_path = 'sqlite:' . STORAGE_SQLITE; 30 $db_path = 'sqlite:' . STORAGE_SQLITE;
31 $this->handle = new PDO($db_path); 31 $this->handle = new PDO($db_path);
32 break; 32 break;
33 case 'mysql': 33 case 'mysql':
34 $db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB; 34 $db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB . ';charset=utf8mb4';
35 $this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD); 35 $this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array(
36 PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
37 ));
36 break; 38 break;
37 case 'postgres': 39 case 'postgres':
38 $db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB; 40 $db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;