From 2ba05ab405ee509af277667df73f8b7caee1b85d Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 2 Jun 2017 15:31:51 -0700 Subject: [PATCH] Don't delete temp file for download if it was pre-created in /tmp/.webmin https://virtualmin.com/node/52315 --- mysql/backup_db.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql/backup_db.cgi b/mysql/backup_db.cgi index 20d123497..75e456e44 100755 --- a/mysql/backup_db.cgi +++ b/mysql/backup_db.cgi @@ -142,6 +142,7 @@ if (!$in{'save'}) { } } foreach $db (@dbs) { + my $deletefile = 0; if ($in{'all'}) { # File in a directory $dir = &date_subs($in{'file'}); @@ -149,10 +150,12 @@ if (!$in{'save'}) { $file = $dir."/".$db.".sql". ($in{'compress'} == 1 ? ".gz" : $in{'compress'} == 2 ? ".bz2" : ""); + $deletefile = 1; } elsif (!$in{'dest'}) { # Single file $file = &date_subs($in{'file'}); + $deletefile = 1; } else { # Temp file for download @@ -176,7 +179,7 @@ if (!$in{'save'}) { next; } } - unlink($file); + &unlink_file($file) if ($deletefile); local $err = &backup_database($db, $file, $in{'compress'}, $in{'drop'}, $in{'where_def'} ? undef : $in{'where'}, $in{'charset_def'} ? undef : $in{'charset'},