diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-02-25 19:16:29 -0600 |
---|---|---|
committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-02-25 19:16:29 -0600 |
commit | 6045aa7aa2fb63358e3f736504b17533b1085712 (patch) | |
tree | 7ffa70c53fe464a94fbce2158b94ecf6d14e2df1 /phpBB/includes/db/migrator.php | |
parent | 9b38c4579e80a9013b6ecad71fce38e930b67838 (diff) | |
download | forums-6045aa7aa2fb63358e3f736504b17533b1085712.tar forums-6045aa7aa2fb63358e3f736504b17533b1085712.tar.gz forums-6045aa7aa2fb63358e3f736504b17533b1085712.tar.bz2 forums-6045aa7aa2fb63358e3f736504b17533b1085712.tar.xz forums-6045aa7aa2fb63358e3f736504b17533b1085712.zip |
[ticket/11367] Migrator throws error if migrations table does not exist
Force load_migration_state to not throw errors if the table does not exist.
PHPBB3-11367
Diffstat (limited to 'phpBB/includes/db/migrator.php')
-rw-r--r-- | phpBB/includes/db/migrator.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/phpBB/includes/db/migrator.php b/phpBB/includes/db/migrator.php index 41d996b1e3..ea5de3372f 100644 --- a/phpBB/includes/db/migrator.php +++ b/phpBB/includes/db/migrator.php @@ -99,18 +99,26 @@ class phpbb_db_migrator { $this->migration_state = array(); + // prevent errors in case the table does not exist yet + $this->db->sql_return_on_error(true); + $sql = "SELECT * FROM " . $this->migrations_table; $result = $this->db->sql_query($sql); - while ($migration = $this->db->sql_fetchrow($result)) + if (!$this->db->sql_error_triggered) { - $this->migration_state[$migration['migration_name']] = $migration; + while ($migration = $this->db->sql_fetchrow($result)) + { + $this->migration_state[$migration['migration_name']] = $migration; + + $this->migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + } - $this->migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + $this->db->sql_freeresult($result); } - $this->db->sql_freeresult($result); + $this->db->sql_return_on_error(false); } /** |