Simplified code for 'export' functionality of Routines, Triggers and Events
This commit is contained in:
parent
d1f0b34ab5
commit
ccd1cc3f9e
@ -11,16 +11,15 @@ if (! defined('PHPMYADMIN')) {
|
||||
* This function is called from one of the other functions in this file
|
||||
* and it completes the handling of the export functionality.
|
||||
*
|
||||
* @param bool $success Whether the export was successful
|
||||
* @param string $item_name The name of the item that we are exporting
|
||||
* @param string $export_data The SQL query to create the requested item
|
||||
*/
|
||||
function PMA_RTE_handleExport($success, $item_name, $export_data)
|
||||
function PMA_RTE_handleExport($item_name, $export_data)
|
||||
{
|
||||
global $db, $table, $human_name;
|
||||
|
||||
$item_name = htmlspecialchars(PMA_backquote($_GET['item_name']));
|
||||
if ($success) {
|
||||
if ($export_data !== false) {
|
||||
$export_data = '<textarea cols="40" rows="15" style="width: 100%;">'
|
||||
. htmlspecialchars($export_data) . '</textarea>';
|
||||
// l10n: Sample output: 'Export of event `testevent`' or 'Export of trigger `mytrigger`'
|
||||
@ -58,13 +57,9 @@ function PMA_EVN_handleExport()
|
||||
global $_GET, $db;
|
||||
|
||||
if (! empty($_GET['export_item']) && ! empty($_GET['item_name'])) {
|
||||
$success = false;
|
||||
$item_name = $_GET['item_name'];
|
||||
$export_data = PMA_DBI_get_definition($db, 'EVENT', $item_name);
|
||||
if ($export_data !== false) {
|
||||
$success = true;
|
||||
}
|
||||
PMA_RTE_handleExport($success, $item_name, $export_data);
|
||||
PMA_RTE_handleExport($item_name, $export_data);
|
||||
}
|
||||
} // end PMA_EVN_handleExport()
|
||||
|
||||
@ -77,7 +72,6 @@ function PMA_RTN_handleExport()
|
||||
global $_GET, $db;
|
||||
|
||||
if (! empty($_GET['export_item']) && ! empty($_GET['item_name'])) {
|
||||
$success = false;
|
||||
$item_name = $_GET['item_name'];
|
||||
$type = PMA_DBI_fetch_value(
|
||||
"SELECT ROUTINE_TYPE "
|
||||
@ -86,10 +80,7 @@ function PMA_RTN_handleExport()
|
||||
. "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($item_name) . "';"
|
||||
);
|
||||
$export_data = PMA_DBI_get_definition($db, $type, $item_name);
|
||||
if ($export_data !== false) {
|
||||
$success = true;
|
||||
}
|
||||
PMA_RTE_handleExport($success, $item_name, $export_data);
|
||||
PMA_RTE_handleExport($item_name, $export_data);
|
||||
}
|
||||
} // end PMA_RTN_handleExport()
|
||||
|
||||
@ -102,7 +93,6 @@ function PMA_TRI_handleExport()
|
||||
global $_GET, $db, $table;
|
||||
|
||||
if (! empty($_GET['export_item']) && ! empty($_GET['item_name'])) {
|
||||
$success = false;
|
||||
$item_name = $_GET['item_name'];
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
$export_data = false;
|
||||
@ -112,10 +102,7 @@ function PMA_TRI_handleExport()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($export_data !== false) {
|
||||
$success = true;
|
||||
}
|
||||
PMA_RTE_handleExport($success, $item_name, $export_data);
|
||||
PMA_RTE_handleExport($item_name, $export_data);
|
||||
}
|
||||
} // end PMA_TRI_handleExport()
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user