diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-11 18:30:35 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-11 18:30:35 +0200 |
commit | 210310b584a0bd816132efa3d8f1ce082efebf88 (patch) | |
tree | de0369ecb304899b766a7c8292565497e5148bf9 /phpBB/phpbb | |
parent | 3346609126893799169dc678da732d99d506fb9f (diff) | |
parent | c12d67cd900514f9752d7bb73928870dbab0a0ce (diff) | |
download | forums-210310b584a0bd816132efa3d8f1ce082efebf88.tar forums-210310b584a0bd816132efa3d8f1ce082efebf88.tar.gz forums-210310b584a0bd816132efa3d8f1ce082efebf88.tar.bz2 forums-210310b584a0bd816132efa3d8f1ce082efebf88.tar.xz forums-210310b584a0bd816132efa3d8f1ce082efebf88.zip |
Merge branch 'ticket/14742' into ticket/14742-32x
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/migrator.php | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 030afe07ad..89f05f7b40 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -82,7 +82,7 @@ class migrator * * @var array */ - public $last_run_migration = false; + protected $last_run_migration = false; /** * The output handler. A null handler is configured by default. @@ -163,6 +163,19 @@ class migrator } /** + * Get an array with information about the last migration run. + * + * The array contains 'name', 'class' and 'state'. 'effectively_installed' is set + * and set to true if the last migration was effectively_installed. + * + * @return array + */ + public function get_last_run_migration() + { + return $this->last_run_migration; + } + + /** * Sets the list of available migration class names to the given array. * * @param array $class_names An array of migration class names @@ -481,12 +494,15 @@ class migrator WHERE migration_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + $this->last_run_migration = false; unset($this->migration_state[$name]); $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); } else { + $this->set_migration_state($name, $state); + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); } } @@ -513,6 +529,9 @@ class migrator $steps = array_reverse($steps); } + end($steps); + $last_step_identifier = key($steps); + foreach ($steps as $step_identifier => $step) { $last_result = 0; @@ -529,6 +548,12 @@ class migrator // Set state to false since we reached the point we were at $state = false; + + // There is a tendency to get stuck in some cases + if ($last_result === null || $last_result === true) + { + continue; + } } try @@ -537,7 +562,8 @@ class migrator // 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 && strpos($step[0], 'dbtools') !== 0) + if (($result !== null && $result !== true) || + (strpos($step[0], 'dbtools') === 0 && $step_identifier !== $last_step_identifier)) { return serialize(array( 'result' => $result, |