diff options
author | David M <davidmj@users.sourceforge.net> | 2008-01-10 21:46:46 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2008-01-10 21:46:46 +0000 |
commit | 35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc (patch) | |
tree | 030c728c3786a8f1ca84d9f294e9dca838ed661c /phpBB/install/install_install.php | |
parent | b9b46a8b454b2ad34ff1a15b0cfd7bd9eb969cb6 (diff) | |
download | forums-35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc.tar forums-35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc.tar.gz forums-35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc.tar.bz2 forums-35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc.tar.xz forums-35f59ceb9a19bcc6f6ba235d554638e3d31cd5dc.zip |
we enter a brave new world...
- fix schema data so that it can now be used
- replace the current system of packaging schemas with phpBB with a new system that dynamically generates the schemas on the fly
- give the db tools package the power to create databases
git-svn-id: file:///svn/phpbb/trunk@8318 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install/install_install.php')
-rwxr-xr-x | phpBB/install/install_install.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f4fc2f298c..4dc5696b73 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1166,24 +1166,31 @@ class install_install extends module $remove_remarks = $available_dbms[$data['dbms']]['COMMENTS']; $delimiter = $available_dbms[$data['dbms']]['DELIM']; - $sql_query = @file_get_contents($dbms_schema); - $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); + include($phpbb_root_path . 'includes/db/db_tools.php'); + include($phpbb_root_path . 'install/schemas/schema_data.php'); - $remove_remarks($sql_query); + $tools = new phpbb_db_tools($db); - $sql_query = split_sql_file($sql_query, $delimiter); + // we must do this so that we can handle the errors + $tools->return_statements = true; - foreach ($sql_query as $sql) + foreach ($schema_data as $table_name => $table_data) { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) + // Change prefix + $table_name = preg_replace('#phpbb_#i', $data['table_prefix'], $table_name); + + $statements = $tools->sql_create_table($table_name, $table_data); + + foreach ($statements as $sql) { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + if (!$db->sql_query($sql)) + { + $error = $db->sql_error(); + $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + } } } - unset($sql_query); // Ok tables have been built, let's fill in the basic information $sql_query = file_get_contents('schemas/schema_data.sql'); |