[go: nahoru, domu]

Skip to content

Commit

Permalink
Adds non-conflicting default new database name #13099
Browse files Browse the repository at this point in the history
Signed-off-by: Raghuram Vadapalli<raghuram.vadapalli@research.iiit.ac.in>
  • Loading branch information
Achilles-96 committed Mar 19, 2017
1 parent 2dfc7af commit c4c4c8b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libraries/operations.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,18 @@ function PMA_getHtmlForCopyDatabase($db)
if (Util::showIcons('ActionLinksMode')) {
$html_output .= Util::getImage('b_edit.png') . '&nbsp';
}
$new_db_name = $db;
$tmp_query = 'SHOW DATABASES LIKE \'' . $new_db_name . '\'';
$tail = 1;
while(sizeof($GLOBALS['dbi']->fetchResult($tmp_query)) > 0) {
$new_db_name = $db . '_' . (string) $tail;
$tmp_query = 'SHOW DATABASES LIKE \'' . $new_db_name . '\'';
$tail += 1;
}
$html_output .= __('Copy database to')
. '</legend>'
. '<input type="text" maxlength="64" name="newname" size="30" '
. 'class="textfield" value="' . htmlspecialchars($db) . '" '
. 'class="textfield" value="' . htmlspecialchars($new_db_name) . '" '
. 'required="required" /><br />'
. Util::getRadioFields(
'what', $choices, 'data', true
Expand Down

0 comments on commit c4c4c8b

Please sign in to comment.