Fixes #11538
Signed-off-by: Raghuram Vadapalli <raghuram.vadapalli@research.iiit.ac.in>
This commit is contained in:
parent
8ff09ad52e
commit
bd2dcfcdc7
@ -88,6 +88,22 @@ if (! empty($submit_mult)
|
||||
unset($submit_mult);
|
||||
include 'db_export.php';
|
||||
exit;
|
||||
case 'copy_tbl':
|
||||
$views = $GLOBALS['dbi']->getVirtualTables($db);
|
||||
list($full_query, $reload, $full_query_views)
|
||||
= PMA_getQueryFromSelected(
|
||||
$submit_mult, $table, $selected, $views
|
||||
);
|
||||
$_url_params = PMA_getUrlParams(
|
||||
$submit_mult, $reload, $action, $db, $table, $selected, $views,
|
||||
isset($original_sql_query)? $original_sql_query : null,
|
||||
isset($original_url_query)? $original_url_query : null
|
||||
);
|
||||
$response = PMA\libraries\Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getHtmlForCopyMultipleTables($action, $_url_params)
|
||||
);
|
||||
exit;
|
||||
case 'show_create':
|
||||
$show_create = PMA\libraries\Template::get(
|
||||
'database/structure/show_create'
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PMA\libraries\Table;
|
||||
|
||||
/**
|
||||
* Gets url params
|
||||
@ -98,6 +99,7 @@ function PMA_buildOrExecuteQueryForMulti(
|
||||
|
||||
$selected_cnt = count($selected);
|
||||
$deletes = false;
|
||||
$copy_tbl =false;
|
||||
|
||||
for ($i = 0; $i < $selected_cnt; $i++) {
|
||||
switch ($query_type) {
|
||||
@ -268,11 +270,16 @@ function PMA_buildOrExecuteQueryForMulti(
|
||||
$run_parts = true;
|
||||
break;
|
||||
|
||||
case 'copy_tbl':
|
||||
$run_parts = true;
|
||||
$copy_tbl = true;
|
||||
Table::moveCopy($db, $selected[$i], $_POST['target_db'], $selected[$i], 'data', false, 'one_table');
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
// All "DROP TABLE", "DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
|
||||
// statements will be run at once below
|
||||
if ($run_parts) {
|
||||
if ($run_parts && !$copy_tbl) {
|
||||
$sql_query .= $a_query . ';' . "\n";
|
||||
if ($query_type != 'drop_db') {
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
@ -301,6 +308,32 @@ function PMA_buildOrExecuteQueryForMulti(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets HTML for copy tables form
|
||||
*
|
||||
* @param string $action action type
|
||||
* @param array $_url_params URL params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForCopyMultipleTables($action, $_url_params)
|
||||
{
|
||||
$html = '<form action="' . $action . '" method="post">';
|
||||
$html .= PMA_URL_getHiddenInputs($_url_params);
|
||||
$html .= '<fieldset class = "input">';
|
||||
$html .= '<legend>' . __('Copy tables') . '</legend>';
|
||||
$html .= '<select class="halfWidth" name="target_db" >'
|
||||
. $GLOBALS['pma']->databases->getHtmlOptions(true, false)
|
||||
. '</select>';
|
||||
$html .= '</fieldset>';
|
||||
$html .= '<fieldset class = "tblFooters">';
|
||||
$html .= '<input type="hidden" name="mult_btn" value="' . __('Yes') . '" />';
|
||||
$html .= '<input type="submit" value="' . __('Copy') . '" />';
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</form>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets HTML for replace_prefix_tbl or copy_tbl_change_prefix
|
||||
*
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<?php endif; ?>
|
||||
<select name="submit_mult" class="autosubmit" style="margin: 0 3em 0 3em;">
|
||||
<option value="<?php echo __('With selected:'); ?>" selected="selected"><?php echo __('With selected:'); ?></option>
|
||||
<option value="copy_tbl"><?php echo __('Copy table')?></option>
|
||||
<option value="show_create" ><?php echo __('Show create'); ?></option>
|
||||
<option value="export" ><?php echo __('Export'); ?></option>
|
||||
<?php if (!$db_is_system_schema
|
||||
|
||||
Loading…
Reference in New Issue
Block a user