mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 14:20:31 +01:00
Add backup option for --quick flag
This commit is contained in:
@@ -91,7 +91,9 @@ foreach $db (@dbs) {
|
||||
\@compat,
|
||||
\@tables,
|
||||
"root",
|
||||
$config{'backup_single_'.$sf});
|
||||
$config{'backup_single_'.$sf},
|
||||
$config{'backup_quick_'.$sf},
|
||||
);
|
||||
if ($err) {
|
||||
$ex = 1;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ if ($module_info{'usermin'}) {
|
||||
$userconfig{'backup_compress_'.$in{'db'}} = $in{'compress'};
|
||||
$userconfig{'backup_drop_'.$in{'db'}} = $in{'drop'};
|
||||
$userconfig{'backup_single_'.$in{'db'}} = $in{'single'};
|
||||
$userconfig{'backup_quick_'.$in{'db'}} = $in{'quick'};
|
||||
$userconfig{'backup_tables_'.$in{'db'}} = join(" ", @tables);
|
||||
&write_file("$user_module_config_directory/config", \%userconfig);
|
||||
}
|
||||
@@ -97,6 +98,7 @@ else {
|
||||
$config{'backup_compress_'.$in{'db'}} = $in{'compress'};
|
||||
$config{'backup_drop_'.$in{'db'}} = $in{'drop'};
|
||||
$config{'backup_single_'.$in{'db'}} = $in{'single'};
|
||||
$config{'backup_quick_'.$in{'db'}} = $in{'quick'};
|
||||
$config{'backup_tables_'.$in{'db'}} = join(" ", @tables);
|
||||
&write_file("$module_config_directory/config", \%config);
|
||||
}
|
||||
@@ -139,7 +141,8 @@ if (!$in{'save'}) {
|
||||
local $err = &backup_database($db, $file, $in{'compress'},
|
||||
$in{'drop'}, $in{'where_def'} ? undef : $in{'where'},
|
||||
$in{'charset_def'} ? undef : $in{'charset'},
|
||||
\@compat, \@tables, $access{'buser'}, $in{'single'});
|
||||
\@compat, \@tables, $access{'buser'}, $in{'single'},
|
||||
$in{'quick'});
|
||||
if ($err) {
|
||||
print "$main::whatfailed : ",
|
||||
&text('backup_ebackup',"<pre>$err</pre>"),"<p>\n";
|
||||
|
||||
@@ -126,6 +126,11 @@ $s = $c{'backup_single_'.$in{'db'}};
|
||||
print &ui_table_row($text{'backup_single'},
|
||||
&ui_yesno_radio("single", $s ? 1 : 0));
|
||||
|
||||
# Show quick dump mode
|
||||
$q = $c{'backup_quick_'.$in{'db'}};
|
||||
print &ui_table_row($text{'backup_quick'},
|
||||
&ui_yesno_radio("quick", $q ? 1 : 0));
|
||||
|
||||
if ($cron) {
|
||||
# Show before/after commands
|
||||
$b = $c{'backup_before_'.$in{'db'}};
|
||||
|
||||
@@ -684,6 +684,7 @@ backup_where=Only backup rows matching <tt>where</tt> clause
|
||||
backup_none=All rows
|
||||
backup_drop=Add <tt>drop table</tt> statements to backup?
|
||||
backup_single=Backup within a transaction?
|
||||
backup_quick=Dump rows one at a time?
|
||||
backup_charset=Character set for backup
|
||||
backup_ok=Backup Now
|
||||
backup_ok1=Save and Backup Now
|
||||
|
||||
@@ -1354,13 +1354,13 @@ return $two eq "\037\213" ? 1 :
|
||||
|
||||
# backup_database(db, dest-file, compress-mode, drop-flag, where-clause,
|
||||
# charset, &compatible, &only-tables, run-as-user,
|
||||
# single-transaction-flag)
|
||||
# single-transaction-flag, quick-flag)
|
||||
# Backs up a database to the given file, optionally with compression. Returns
|
||||
# undef on success, or an error message on failure.
|
||||
sub backup_database
|
||||
{
|
||||
local ($db, $file, $compress, $drop, $where, $charset, $compatible,
|
||||
$tables, $user, $single) = @_;
|
||||
$tables, $user, $single, $quick) = @_;
|
||||
if ($compress == 0) {
|
||||
$writer = ">".quotemeta($file);
|
||||
}
|
||||
@@ -1372,6 +1372,7 @@ elsif ($compress == 2) {
|
||||
}
|
||||
local $dropsql = $drop ? "--add-drop-table" : "";
|
||||
local $singlesql = $single ? "--single-transaction" : "";
|
||||
local $quicksql = $quick ? "--quick" : "";
|
||||
local $wheresql = $where ? "\"--where=$in{'where'}\"" : "";
|
||||
local $charsetsql = $charset ?
|
||||
"--default-character-set=".quotemeta($charset) : "";
|
||||
@@ -1380,7 +1381,7 @@ local $compatiblesql = @$compatible ?
|
||||
local $quotingsql = &supports_quoting() ? "--quote-names" : "";
|
||||
local $routinessql = &supports_routines() ? "--routines" : "";
|
||||
local $tablessql = join(" ", map { quotemeta($_) } @$tables);
|
||||
local $cmd = "$config{'mysqldump'} $authstr $dropsql $singlesql $wheresql $charsetsql $compatiblesql $quotingsql $routinessql ".quotemeta($db)." $tablessql 2>&1 $writer";
|
||||
local $cmd = "$config{'mysqldump'} $authstr $dropsql $singlesql $quicksql $wheresql $charsetsql $compatiblesql $quotingsql $routinessql ".quotemeta($db)." $tablessql 2>&1 $writer";
|
||||
if ($user && $user ne "root") {
|
||||
$cmd = &command_as_user($user, undef, $cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user