Issue #30: Fixes database_prefix option during install

This commit is contained in:
0xRenegade
2022-09-23 20:55:55 -05:00
parent a20810d650
commit b433a83578
4 changed files with 16 additions and 9 deletions
+4 -1
View File
@@ -31,7 +31,7 @@ class Database {
}
// Function to create the tables and fill them with the default data
function create_tables($db_host, $db_user, $db_password, $db_name, $db_port)
function create_tables($db_host, $db_user, $db_password, $db_name, $db_port, $db_prefix)
{
// Connect to the database
$mysqli = new mysqli($db_host,$db_user,$db_password,$db_name, $db_port);
@@ -43,6 +43,9 @@ class Database {
// Open the default SQL file
$query = file_get_contents('sql/sample_data.sql');
// Run prefix regex; if none is set, then it will replace #prefix# with an empty string.
$query = preg_replace('/#prefix#/', $db_prefix, $query);
// Execute a multi query
$mysqli->multi_query($query);