aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-28 22:58:24 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-29 11:03:42 +0100
commit67737345f615178e924a2a0ecac58d9a75806b32 (patch)
tree0353efef75a2c8ebfe4ec94048e51ab229e95687
parentfd434a2f78989816a5bbc6656a88ec2eeee78902 (diff)
downloadforums-67737345f615178e924a2a0ecac58d9a75806b32.tar
forums-67737345f615178e924a2a0ecac58d9a75806b32.tar.gz
forums-67737345f615178e924a2a0ecac58d9a75806b32.tar.bz2
forums-67737345f615178e924a2a0ecac58d9a75806b32.tar.xz
forums-67737345f615178e924a2a0ecac58d9a75806b32.zip
[ticket/11459] Install DB schema from json file
PHPBB3-11459
-rw-r--r--phpBB/install/install_install.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 009f0dfa33..7c260017cd 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1151,13 +1151,9 @@ class install_install extends module
// How should we treat this schema?
$delimiter = $available_dbms[$data['dbms']]['DELIM'];
-
$sql_query = @file_get_contents($dbms_schema);
-
$sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
-
$sql_query = phpbb_remove_comments($sql_query);
-
$sql_query = split_sql_file($sql_query, $delimiter);
foreach ($sql_query as $sql)
@@ -1171,6 +1167,19 @@ class install_install extends module
}
unset($sql_query);
+ // Ok we have the db info go ahead and work on building the table
+ $db_table_schema = @file_get_contents('schemas/schema.json');
+ $db_table_schema = json_decode($db_table_schema, true);
+
+ $db_tools = new \phpbb\db\tools($db);
+ foreach ($db_table_schema as $table_name => $table_data)
+ {
+ $db_tools->sql_create_table(
+ $data['table_prefix'] . substr($table_name, 6),
+ $table_data
+ );
+ }
+
// Ok tables have been built, let's fill in the basic information
$sql_query = file_get_contents('schemas/schema_data.sql');