forked from wallabag/wallabag
fix bug with utf8mb4
This commit is contained in:
@ -92,6 +92,8 @@ else if (isset($_POST['install'])) {
|
|||||||
if ($_POST['mysql_server'] != "") {$server = $_POST['mysql_server'];} // if server and database are filled
|
if ($_POST['mysql_server'] != "") {$server = $_POST['mysql_server'];} // if server and database are filled
|
||||||
if ($_POST['mysql_database'] != "") {$database = $_POST['mysql_database'];}
|
if ($_POST['mysql_database'] != "") {$database = $_POST['mysql_database'];}
|
||||||
|
|
||||||
|
$sql_structure = file_get_contents('install/mysql.sql');
|
||||||
|
|
||||||
if (isset($_POST['mysql_utf8_mb4'])) {
|
if (isset($_POST['mysql_utf8_mb4'])) {
|
||||||
//with UTF8-MB4
|
//with UTF8-MB4
|
||||||
$db_path = 'mysql:host=' . $server . ';dbname=' . $database . ';charset=utf8mb4';
|
$db_path = 'mysql:host=' . $server . ';dbname=' . $database . ';charset=utf8mb4';
|
||||||
@ -100,7 +102,7 @@ else if (isset($_POST['install'])) {
|
|||||||
));
|
));
|
||||||
$content = str_replace("define ('MYSQL_USE_UTF8MB4', FALSE);", "define ('MYSQL_USE_UTF8MB4', TRUE);", $content);
|
$content = str_replace("define ('MYSQL_USE_UTF8MB4', FALSE);", "define ('MYSQL_USE_UTF8MB4', TRUE);", $content);
|
||||||
} else { // regular UTF8
|
} else { // regular UTF8
|
||||||
$content = str_replace(" DEFAULT CHARSET=utf8mb4", "", $content); // replace the UTF8-MB4 occurences inside the mysql.sql file
|
$sql_structure = str_replace(" DEFAULT CHARSET=utf8mb4", "", $sql_structure); // replace the UTF8-MB4 occurences inside the mysql.sql file
|
||||||
$db_path = 'mysql:host=' . $server . ';dbname=' . $database;
|
$db_path = 'mysql:host=' . $server . ';dbname=' . $database;
|
||||||
$handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']);
|
$handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user