Change mysqlDie() to return the error message when $exit parameter is false

This commit is contained in:
Madhura Jayaratne 2013-03-28 17:34:40 +05:30
parent 71d5c80d6a
commit b3db1f0d6f
4 changed files with 7 additions and 9 deletions

View File

@ -603,7 +603,8 @@ class PMA_Util
}
/**
* Displays a MySQL error message in the right frame.
* Displays a MySQL error message in the right frame when $exit is true.
* Returns the error message otherwise.
*
* @param string $error_message the error message
* @param string $the_query the sql query that failed
@ -611,7 +612,7 @@ class PMA_Util
* @param string $back_url the "back" link url (full path is not required)
* @param bool $exit EXIT the page?
*
* @return void
* @return mixed
*
* @global string the curent table
* @global string the current db
@ -765,7 +766,7 @@ class PMA_Util
echo $error_msg;
exit;
} else {
echo $error_msg;
return $error_msg;
}
} // end of the 'mysqlDie()' function

View File

@ -126,7 +126,7 @@ class AuthenticationConfig extends AuthenticationPlugin
), E_USER_WARNING
);
}
PMA_Util::mysqlDie(
echo PMA_Util::mysqlDie(
$conn_error, '', true, '', false
);
}

View File

@ -420,7 +420,7 @@ if (isset($_REQUEST['do_save_data'])) {
$response->isSuccess(false);
$response->addJSON('message', PMA_DBI_getError());
} else {
PMA_Util::mysqlDie('', '', '', $err_url, false);
echo PMA_Util::mysqlDie('', '', '', $err_url, false);
// An error happened while inserting/updating a table definition.
// To prevent total loss of that data, we embed the form once again.
// The variable $regenerate will be used to restore data in

View File

@ -210,12 +210,9 @@ if (isset($_REQUEST['destination_foreign'])) {
if (substr($tmp_error_create, 1, 4) == '1216'
|| substr($tmp_error_create, 1, 4) == '1452'
) {
ob_start();
PMA_Util::mysqlDie(
$html_output .= PMA_Util::mysqlDie(
$tmp_error_create, $create_query, false, '', false
);
$html_output .= ob_get_contents();
ob_end_clean();
$html_output .= PMA_Util::showMySQLDocu(
'manual_Table_types', 'InnoDB_foreign_key_constraints'
) . "\n";