diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-10 14:55:39 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-11 01:09:11 +0200 |
commit | 8e1461ca61e3f452935a1253d3afe65e7322d6bc (patch) | |
tree | 24b40c1b339cb7a78ee52f834fffdf4d97b067de /phpBB/phpbb/db/migrator.php | |
parent | 9fb649793de65a598615c542861281ff15a60439 (diff) | |
download | forums-8e1461ca61e3f452935a1253d3afe65e7322d6bc.tar forums-8e1461ca61e3f452935a1253d3afe65e7322d6bc.tar.gz forums-8e1461ca61e3f452935a1253d3afe65e7322d6bc.tar.bz2 forums-8e1461ca61e3f452935a1253d3afe65e7322d6bc.tar.xz forums-8e1461ca61e3f452935a1253d3afe65e7322d6bc.zip |
[ticket/14742] Avoid loop while reverting data
This combines reverted updata_data and revert_data into a single array.
PHPBB3-14742
Diffstat (limited to 'phpBB/phpbb/db/migrator.php')
-rw-r--r-- | phpBB/phpbb/db/migrator.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 739959d7b7..3e69d9613e 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -423,19 +423,11 @@ class migrator if ($state['migration_data_done']) { - if ($state['migration_data_state'] !== 'revert_data') - { - $result = $this->process_data_step($migration->update_data(), $state['migration_data_state'], true); - - $state['migration_data_state'] = ($result === true) ? 'revert_data' : $result; - } - else - { - $result = $this->process_data_step($migration->revert_data(), '', false); + $steps = array_merge($this->helper->reverse_update_data($migration->update_data()), $migration->revert_data()); + $result = $this->process_data_step($steps, $state['migration_data_state']); - $state['migration_data_state'] = ($result === true) ? '' : $result; - $state['migration_data_done'] = ($result === true) ? false : true; - } + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_data_done'] = ($result === true) ? false : true; $this->set_migration_state($name, $state); } @@ -596,6 +588,13 @@ class migrator throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); } + if ($reverse) + { + // We might get unexpected results when trying + // to revert this, so just avoid it + return false; + } + $condition = $parameters[0]; if (!$condition) |