aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-02-14 15:12:02 +0100
committerThomas Citharel <tcit@tcit.fr>2015-02-14 15:12:02 +0100
commit054c9d8838e6d339f46d22f90655576fa1d1231d (patch)
treea4bf71980c55b60c843248b780c90c48e001ab30 /inc
parent7780b8cb370625e27894636ecce555c8200b6108 (diff)
downloadwallabag-054c9d8838e6d339f46d22f90655576fa1d1231d.tar.gz
wallabag-054c9d8838e6d339f46d22f90655576fa1d1231d.tar.zst
wallabag-054c9d8838e6d339f46d22f90655576fa1d1231d.zip
(definitely) fixed utf8mb4 and check if user already exists in database before installing first user
Diffstat (limited to 'inc')
-rwxr-xr-xinc/poche/Database.class.php13
-rwxr-xr-xinc/poche/config.inc.default.php1
2 files changed, 10 insertions, 4 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 6bac0f5d..a987b7cc 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -31,10 +31,15 @@ class Database {
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 . ';charset=utf8mb4'; 34 if (MYSQL_USE_UTF8MB4) {
35 $this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array( 35 $db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB . ';charset=utf8mb4';
36 PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', 36 $this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array(
37 )); 37 PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
38 ));
39 } else {
40 $db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
41 $this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD);
42 }
38 break; 43 break;
39 case 'postgres': 44 case 'postgres':
40 $db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB; 45 $db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php
index 6750383e..16b96f7e 100755
--- a/inc/poche/config.inc.default.php
+++ b/inc/poche/config.inc.default.php
@@ -20,6 +20,7 @@
20@define ('STORAGE_DB', 'poche'); 20@define ('STORAGE_DB', 'poche');
21@define ('STORAGE_USER', 'poche'); 21@define ('STORAGE_USER', 'poche');
22@define ('STORAGE_PASSWORD', 'poche'); 22@define ('STORAGE_PASSWORD', 'poche');
23@define ('MYSQL_USE_UTF8MB4', FALSE); // This should be false unless you know what it is
23 24
24################################################################################# 25#################################################################################
25# Do not trespass unless you know what you are doing 26# Do not trespass unless you know what you are doing