1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

Merge branch 'ticket/14742' into ticket/14742-32x

This commit is contained in:
Oliver Schramm
2016-08-11 01:20:59 +02:00
8 changed files with 133 additions and 18 deletions

View File

@@ -89,7 +89,7 @@ class migrator
*
* @var migrator_output_handler_interface
*/
public $output_handler;
protected $output_handler;
/**
* Constructor of the database migrator
@@ -328,7 +328,14 @@ class migrator
$state['migration_data_state'] = ($result === true) ? '' : $result;
$state['migration_schema_done'] = ($result === true);
$this->output_handler->write(array('MIGRATION_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL);
if ($state['migration_schema_done'])
{
$this->output_handler->write(array('MIGRATION_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL);
}
else
{
$this->output_handler->write(array('MIGRATION_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE);
}
}
else if (!$state['migration_data_done'])
{
@@ -346,7 +353,7 @@ class migrator
$state['migration_data_done'] = ($result === true);
$state['migration_end_time'] = ($result === true) ? time() : 0;
if ($state['migration_schema_done'])
if ($state['migration_data_done'])
{
$this->output_handler->write(array('MIGRATION_DATA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL);
}
@@ -360,7 +367,6 @@ class migrator
// Revert the schema changes
$this->revert_do($name);
// Rethrow exception
throw $e;
}
}
@@ -439,19 +445,11 @@ class migrator
$this->output_handler->write(array('MIGRATION_REVERT_DATA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE);
$elapsed_time = microtime(true);
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);
@@ -532,8 +530,10 @@ class migrator
try
{
// Result will be null or true if everything completed correctly
// After any schema update step we allow to pause, since
// database changes can take quite some time
$result = $this->run_step($step, $last_result, $revert);
if ($result !== null && $result !== true)
if ($result !== null && $result !== true && strpos($step[0], 'dbtools') !== 0)
{
return serialize(array(
'result' => $result,
@@ -556,7 +556,6 @@ class migrator
$this->run_step($reverse_step, false, !$revert);
}
// rethrow the exception
throw $e;
}
}
@@ -626,6 +625,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)