diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2014-10-07 14:53:03 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2014-10-07 14:55:08 +0200 |
| commit | 4fe95d6870ab1700f104b16223791933c8e50ff9 (patch) | |
| tree | dbbe016a8adc201a949ffeac74aff135931534b5 /phpBB | |
| parent | 943f2e1a7ba9264dcf0ec4c2b0f4f8e89a07b5ce (diff) | |
| download | forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.gz forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.bz2 forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.xz forums-4fe95d6870ab1700f104b16223791933c8e50ff9.zip | |
[ticket/13137] Generate the schema when the schema.json file is not available
PHPBB3-13137
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/install/install_install.php | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 9867c56a3f..103262b516 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1175,8 +1175,31 @@ class install_install extends module } // 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); + if (file_exists('schemas/schema.json')) + { + $db_table_schema = @file_get_contents('schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + } + else + { + global $phpbb_root_path, $phpEx, $table_prefix; + $table_prefix = 'phpbb_'; + + if (!defined('CONFIG_TABLE')) + { + // We need to include the constants file for the table constants + // when we generate the schema from the migration files. + include($phpbb_root_path . 'includes/constants.' . $phpEx); + } + + $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); + $classes = $finder->core_path('phpbb/db/migration/data/') + ->get_classes(); + + $sqlite_db = new \phpbb\db\driver\sqlite(); + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, new \phpbb\db\tools($sqlite_db, true), $phpbb_root_path, $phpEx, $table_prefix); + $db_table_schema = $schema_generator->get_schema(); + } if (!defined('CONFIG_TABLE')) { |
