diff options
Diffstat (limited to 'phpBB/phpbb/console/command/db/migrate.php')
-rw-r--r-- | phpBB/phpbb/console/command/db/migrate.php | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index c760cde5b5..ecb84d7401 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -53,6 +53,30 @@ class migrate extends \phpbb\console\command\command protected function execute(InputInterface $input, OutputInterface $output) { + $user = $this->user; + $this->migrator->set_output_handler( + new \phpbb\db\migrator_output_handler( + function($message, $verbosity) use ($output, $user) + { + if ($verbosity <= $output->getVerbosity()) + { + $final_message = call_user_func_array(array($user, 'lang'), $message); + + if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) + { + $final_message = '<info>' . $final_message . '</info>'; + } + else if ($verbosity === \phpbb\db\migrator_output_handler::VERBOSITY_VERY_VERBOSE) + { + $final_message = '<comment>' . $final_message . '</comment>'; + } + + $output->writeln($final_message); + } + } + ) + ); + $this->migrator->create_migrations_table(); $this->cache->purge(); @@ -61,8 +85,6 @@ class migrate extends \phpbb\console\command\command $orig_version = $this->config['version']; while (!$this->migrator->finished()) { - $migration_start_time = microtime(true); - try { $this->migrator->update(); @@ -73,36 +95,6 @@ class migrate extends \phpbb\console\command\command $this->finalise_update(); return 1; } - - $migration_stop_time = microtime(true) - $migration_start_time; - - $state = array_merge( - array( - 'migration_schema_done' => false, - 'migration_data_done' => false, - ), - $this->migrator->last_run_migration['state'] - ); - - if (!empty($this->migrator->last_run_migration['effectively_installed'])) - { - $msg = $this->user->lang('MIGRATION_EFFECTIVELY_INSTALLED', $this->migrator->last_run_migration['name']); - $output->writeln("<comment>$msg</comment>"); - } - else if ($this->migrator->last_run_migration['task'] == 'process_data_step' && $state['migration_data_done']) - { - $msg = $this->user->lang('MIGRATION_DATA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); - $output->writeln("<info>$msg</info>"); - } - else if ($this->migrator->last_run_migration['task'] == 'process_data_step') - { - $output->writeln($this->user->lang('MIGRATION_DATA_IN_PROGRESS', $this->migrator->last_run_migration['name'], $migration_stop_time)); - } - else if ($state['migration_schema_done']) - { - $msg = $this->user->lang('MIGRATION_SCHEMA_DONE', $this->migrator->last_run_migration['name'], $migration_stop_time); - $output->writeln("<info>$msg</info>"); - } } if ($orig_version != $this->config['version']) |