1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 23:11:45 +02:00

[ticket/14742] Avoid loop while reverting data

This combines reverted updata_data and revert_data into a single array.

PHPBB3-14742
This commit is contained in:
Oliver Schramm
2016-08-10 14:55:39 +02:00
parent 9fb649793d
commit 8e1461ca61
6 changed files with 63 additions and 12 deletions

View File

@@ -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);
$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) ? 'revert_data' : $result;
}
else
{
$result = $this->process_data_step($migration->revert_data(), '', false);
$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)