diff options
author | Zoddo <zoddo.ino@gmail.com> | 2015-09-13 16:08:22 +0200 |
---|---|---|
committer | Zoddo <zoddo.ino@gmail.com> | 2015-09-20 12:26:46 +0200 |
commit | 2596fba487a067cba36b5ebe50e1c73e4dc954d3 (patch) | |
tree | e682206c3d7b197a7bcf973e8bdbd96565c53dc4 /phpBB/phpbb/db/migrator.php | |
parent | 3bde202a1087a06baa6b06a7612001f0478da580 (diff) | |
download | forums-2596fba487a067cba36b5ebe50e1c73e4dc954d3.tar forums-2596fba487a067cba36b5ebe50e1c73e4dc954d3.tar.gz forums-2596fba487a067cba36b5ebe50e1c73e4dc954d3.tar.bz2 forums-2596fba487a067cba36b5ebe50e1c73e4dc954d3.tar.xz forums-2596fba487a067cba36b5ebe50e1c73e4dc954d3.zip |
[ticket/14162] Add CLI command db:revert
This command allow to revert a migration from the CLI
PHPBB3-14162
Diffstat (limited to 'phpBB/phpbb/db/migrator.php')
-rw-r--r-- | phpBB/phpbb/db/migrator.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 6902913c64..18c6403c07 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -416,6 +416,9 @@ class migrator if ($state['migration_data_done']) { + $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); @@ -431,9 +434,22 @@ class migrator } $this->set_migration_state($name, $state); + + $elapsed_time = microtime(true) - $elapsed_time; + if ($state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } } else if ($state['migration_schema_done']) { + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + $elapsed_time = microtime(true); + $steps = $this->helper->get_schema_steps($migration->revert_schema()); $result = $this->process_data_step($steps, $state['migration_data_state']); @@ -448,6 +464,9 @@ class migrator unset($this->migration_state[$name]); } + + $elapsed_time = microtime(true) - $elapsed_time; + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); } return true; |