From d40a48ec39ce3900fcb155c6fecf3f431f66ea78 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 12 Feb 2015 14:37:18 +0530 Subject: [PATCH] rfe Ability to disable foreign key check when emptying tables Signed-off-by: Madhura Jayaratne --- libraries/mult_submits.inc.php | 8 ++++++-- libraries/mult_submits.lib.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index fd4273e7ff..36db950c71 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -215,7 +215,9 @@ if (!empty($submit_mult) && !empty($what)) { } if (! isset($_REQUEST['fk_check']) - && ($query_type == 'drop_tbl' || $query_type == 'row_delete') + && ($query_type == 'drop_tbl' + || $query_type == 'empty_tbl' + || $query_type == 'row_delete') ) { $default_fk_check_value = $GLOBALS['dbi']->fetchValue( 'SHOW VARIABLES LIKE \'foreign_key_checks\';', 0, 1 @@ -273,7 +275,9 @@ if (!empty($submit_mult) && !empty($what)) { } } if (! isset($_REQUEST['fk_check']) - && ($query_type == 'drop_tbl' || $query_type == 'row_delete') + && ($query_type == 'drop_tbl' + || $query_type == 'empty_tbl' + || $query_type == 'row_delete') && $default_fk_check_value ) { $GLOBALS['dbi']->query('SET FOREIGN_KEY_CHECKS = 1;'); diff --git a/libraries/mult_submits.lib.php b/libraries/mult_submits.lib.php index e330153cb7..4d2594a389 100644 --- a/libraries/mult_submits.lib.php +++ b/libraries/mult_submits.lib.php @@ -433,7 +433,7 @@ function PMA_getHtmlForOtherActions($what, $action, $_url_params, $full_query) $html .= '
'; $html .= PMA_URL_getHiddenInputs($_url_params); // Display option to disable foreign key checks while dropping tables - if ($what == 'drop_tbl' || $what == 'row_delete') { + if ($what == 'drop_tbl' || $what == 'empty_tbl' || $what == 'row_delete') { $html .= '
'; $html .= '