From b398fa2050ab720d9a3ae2b809bb3cdf4f153dc6 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 9 Feb 2013 21:09:29 -0600 Subject: [PATCH] [feature/migrations] Catch and display errors from the migrator PHPBB3-11318 --- phpBB/adm/style/acp_ext_enable.html | 8 +++++++- phpBB/adm/style/acp_ext_purge.html | 8 +++++++- phpBB/includes/acp/acp_extensions.php | 28 ++++++++++++++++++++------- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/phpBB/adm/style/acp_ext_enable.html b/phpBB/adm/style/acp_ext_enable.html index 3f7be2c847..35585207eb 100644 --- a/phpBB/adm/style/acp_ext_enable.html +++ b/phpBB/adm/style/acp_ext_enable.html @@ -7,7 +7,13 @@

{L_EXTENSIONS_EXPLAIN}

{L_ENABLE_EXPLAIN}

- + +
+

{L_MIGRATION_EXCEPTION_ERROR}

+

{MIGRATOR_ERROR}

+

{L_RETURN}

+
+

{L_ENABLE_CONFIRM}

diff --git a/phpBB/adm/style/acp_ext_purge.html b/phpBB/adm/style/acp_ext_purge.html index 00a58721cb..94bef82ca5 100644 --- a/phpBB/adm/style/acp_ext_purge.html +++ b/phpBB/adm/style/acp_ext_purge.html @@ -7,7 +7,13 @@

{L_EXTENSIONS_EXPLAIN}

{L_PURGE_EXPLAIN}

- + +
+

{L_MIGRATION_EXCEPTION_ERROR}

+

{MIGRATOR_ERROR}

+

{L_RETURN}

+
+

{L_PURGE_CONFIRM}

diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index a0bcf62ecc..17ab4f3169 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -37,7 +37,7 @@ class acp_extensions $this->template = $template; $this->user = $user; - $user->add_lang(array('install', 'acp/extensions')); + $user->add_lang(array('install', 'acp/extensions', 'migrator')); $this->page_title = 'ACP_EXTENSIONS'; @@ -103,11 +103,18 @@ class acp_extensions trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action)); } - if ($phpbb_extension_manager->enable_step($ext_name)) + try { - $template->assign_var('S_NEXT_STEP', true); + if ($phpbb_extension_manager->enable_step($ext_name)) + { + $template->assign_var('S_NEXT_STEP', true); - meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name)); + meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name)); + } + } + catch (phpbb_db_migration_exception $e) + { + $template->assign_var('MIGRATOR_ERROR', $user->lang($e->getMessage(), $e->getParameters())); } $this->tpl_name = 'acp_ext_enable'; @@ -156,11 +163,18 @@ class acp_extensions break; case 'purge': - if ($phpbb_extension_manager->purge_step($ext_name)) + try { - $template->assign_var('S_NEXT_STEP', true); + if ($phpbb_extension_manager->purge_step($ext_name)) + { + $template->assign_var('S_NEXT_STEP', true); - meta_refresh(0, $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name)); + meta_refresh(0, $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name)); + } + } + catch (phpbb_db_migration_exception $e) + { + $template->assign_var('MIGRATOR_ERROR', $user->lang($e->getMessage(), $e->getParameters())); } $this->tpl_name = 'acp_ext_purge';