1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-01 17:38:38 +00:00

(definitely) fixed utf8mb4 and check if user already exists in database before installing first user

This commit is contained in:
Thomas Citharel 2015-02-14 15:12:02 +01:00
parent 7780b8cb37
commit 054c9d8838
3 changed files with 19 additions and 4 deletions

View file

@ -31,10 +31,15 @@ class Database {
$this->handle = new PDO($db_path);
break;
case 'mysql':
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB . ';charset=utf8mb4';
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
));
if (MYSQL_USE_UTF8MB4) {
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB . ';charset=utf8mb4';
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
));
} else {
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD);
}
break;
case 'postgres':
$db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;

View file

@ -20,6 +20,7 @@
@define ('STORAGE_DB', 'poche');
@define ('STORAGE_USER', 'poche');
@define ('STORAGE_PASSWORD', 'poche');
@define ('MYSQL_USE_UTF8MB4', FALSE); // This should be false unless you know what it is
#################################################################################
# Do not trespass unless you know what you are doing