diff options
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r-- | phpBB/includes/db/migration/migration.php | 15 | ||||
-rw-r--r-- | phpBB/includes/db/migrator.php | 20 |
2 files changed, 32 insertions, 3 deletions
diff --git a/phpBB/includes/db/migration/migration.php b/phpBB/includes/db/migration/migration.php index 4271751362..cf1e97b3b1 100644 --- a/phpBB/includes/db/migration/migration.php +++ b/phpBB/includes/db/migration/migration.php @@ -84,6 +84,21 @@ abstract class phpbb_db_migration } /** + * Allows you to check if the migration is effectively installed (entirely optionall) + * + * This is checked when a migration is installed. If true is returned, the migration will be set as + * installed without performing the database changes. + * This function is intended to help moving to migrations from a previous database updater, where some + * migrations may have been installed already even though they are not yet listed in the migrations table. + * + * @return bool True if this migration is installed, False if this migration is not installed (checked on install) + */ + public function effectively_installed() + { + return false; + } + + /** * Updates the database schema by providing a set of change instructions * * @return array Array of schema changes (compatible with db_tools->perform_schema_changes()) diff --git a/phpBB/includes/db/migrator.php b/phpBB/includes/db/migrator.php index 6b249e3ee0..b56da95b1a 100644 --- a/phpBB/includes/db/migrator.php +++ b/phpBB/includes/db/migrator.php @@ -271,10 +271,24 @@ class phpbb_db_migrator 'class' => $migration, ); - if (!isset($this->migration_state[$name])) + if ($migration->effectively_installed()) { - $state['migration_start_time'] = time(); - $this->insert_migration($name, $state); + $state = array( + 'migration_depends_on' => $migration->depends_on(), + 'migration_schema_done' => true, + 'migration_data_done' => true, + 'migration_data_state' => '', + 'migration_start_time' => 0, + 'migration_end_time' => 0, + ); + } + else + { + if (!isset($this->migration_state[$name])) + { + $state['migration_start_time'] = time(); + $this->insert_migration($name, $state); + } } if (!$state['migration_schema_done']) |