From 56d7c2c6ed3e5924aeced53a163bfd1aa8288034 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 14 Oct 2014 17:58:29 +0200 Subject: [ticket/13126] Improve the feedback when running the migrations PHPBB3-13126 --- phpBB/install/database_update.php | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 8016ff349b..960b3c3fb3 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -174,6 +174,19 @@ define('IN_DB_UPDATE', true); // End startup code $migrator = $phpbb_container->get('migrator'); +$migrator->set_output_handler( + new \phpbb\db\migrator_output_handler( + function($message, $verbosity) use ($user) + { + if ($verbosity <= \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) + { + $final_message = call_user_func_array(array($user, 'lang'), $message); + echo $final_message . "
\n"; + } + } + ) +); + $migrator->create_migrations_table(); $phpbb_extension_manager = $phpbb_container->get('ext.manager'); @@ -199,8 +212,6 @@ $safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2)); while (!$migrator->finished()) { - $migration_start_time = microtime(true); - try { $migrator->update(); @@ -219,28 +230,6 @@ while (!$migrator->finished()) $migrator->last_run_migration['state'] ); - if (isset($migrator->last_run_migration['effectively_installed']) && $migrator->last_run_migration['effectively_installed']) - { - echo $user->lang('MIGRATION_EFFECTIVELY_INSTALLED', $migrator->last_run_migration['name']); - } - else - { - if ($migrator->last_run_migration['task'] == 'process_data_step' && $state['migration_data_done']) - { - echo $user->lang('MIGRATION_DATA_DONE', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - else if ($migrator->last_run_migration['task'] == 'process_data_step') - { - echo $user->lang('MIGRATION_DATA_IN_PROGRESS', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - else if ($state['migration_schema_done']) - { - echo $user->lang('MIGRATION_SCHEMA_DONE', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - } - - echo "
\n"; - // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $update_start_time) >= $safe_time_limit) { -- cgit v1.2.1 From 58075e25e8173ec663e4e8908d1963b1947a225b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 16 Oct 2014 01:34:23 +0200 Subject: [ticket/13126] Extends migrator_output_handler instead of using a closure PHPBB3-13126 --- phpBB/install/database_update.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 960b3c3fb3..5a2287c9e1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -174,18 +174,7 @@ define('IN_DB_UPDATE', true); // End startup code $migrator = $phpbb_container->get('migrator'); -$migrator->set_output_handler( - new \phpbb\db\migrator_output_handler( - function($message, $verbosity) use ($user) - { - if ($verbosity <= \phpbb\db\migrator_output_handler::VERBOSITY_NORMAL) - { - $final_message = call_user_func_array(array($user, 'lang'), $message); - echo $final_message . "
\n"; - } - } - ) -); +$migrator->set_output_handler(new \phpbb\db\html_migrator_output_handler($user)); $migrator->create_migrations_table(); -- cgit v1.2.1 From 516bd9ea51a2c2b908eb1f62bddaba967559db4a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 24 Oct 2014 13:20:40 -0700 Subject: [ticket/13211] Add log wrapper for writing database updater to log file PHPBB3-13211 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5a2287c9e1..80fd40a944 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -174,7 +174,7 @@ define('IN_DB_UPDATE', true); // End startup code $migrator = $phpbb_container->get('migrator'); -$migrator->set_output_handler(new \phpbb\db\html_migrator_output_handler($user)); +$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log')); $migrator->create_migrations_table(); -- cgit v1.2.1