From 80eb1091ee303d07330f671dbe3eac886e911a25 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Sat, 8 Nov 2014 19:33:05 +0100 Subject: [PATCH] Refactorise code. Signed-off-by: Hugues Peccatte --- libraries/rte/rte_triggers.lib.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/libraries/rte/rte_triggers.lib.php b/libraries/rte/rte_triggers.lib.php index 1e1f55ee75..77f9432c17 100644 --- a/libraries/rte/rte_triggers.lib.php +++ b/libraries/rte/rte_triggers.lib.php @@ -96,21 +96,15 @@ function PMA_TRI_handleEditor() // We dropped the old item, but were unable to create the // new one. Try to restore the backup query. $result = $GLOBALS['dbi']->tryQuery($create_item); - if (! $result) { - // OMG, this is really bad! We dropped the query, - // failed to create a new one - // and now even the backup query does not execute! - // This should not happen, but we better handle - // this just in case. - $errors[] = __( + + $errors = checkResult( + $result, + __( 'Sorry, we failed to restore the dropped trigger.' - ) - . '
' - . __('The backed up query was:') - . "\"" . htmlspecialchars($create_item) . "\"" - . '
' - . __('MySQL said: ') . $GLOBALS['dbi']->getError(null); - } + ), + $create_item, + $errors + ); } else { $message = PMA_Message::success( __('Trigger %1$s has been modified.')