mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Expand directory when entered as additonal file
This commit is contained in:
@@ -10,3 +10,5 @@ Made the backup email contents translatable.
|
||||
Added a warning if % is used in filenames but strftime substition is not enabled.
|
||||
---- Changes since 1.330 ----
|
||||
Added tabs to reduce the size of the main page.
|
||||
---- Changes since 1.390 ----
|
||||
When a directory is entered as an additional path to backup, it will be expanded to the list of all files under it when the backup is done.
|
||||
|
||||
@@ -237,8 +237,18 @@ if ($_[4]) {
|
||||
|
||||
# Add other files
|
||||
foreach my $f (@{$_[6]}) {
|
||||
push(@files, $f);
|
||||
push(@{$manifestfiles{"other"}}, $f);
|
||||
if (-d $f) {
|
||||
# A directory .. recursively expand
|
||||
foreach my $sf (&expand_directory($f)) {
|
||||
push(@files, $sf);
|
||||
push(@{$manifestfiles{"other"}}, $sf);
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Just one file
|
||||
push(@files, $f);
|
||||
push(@{$manifestfiles{"other"}}, $f);
|
||||
}
|
||||
}
|
||||
|
||||
# Save the manifest files
|
||||
@@ -576,5 +586,25 @@ $webmin || !$nofiles || $others || &error($text{'save_ewebmin'});
|
||||
return ($webmin, $nofiles, $others);
|
||||
}
|
||||
|
||||
sub expand_directory
|
||||
{
|
||||
local ($dir) = @_;
|
||||
local @rv;
|
||||
opendir(EXPAND, $dir);
|
||||
local @sf = readdir(EXPAND);
|
||||
closedir(EXPAND);
|
||||
foreach my $sf (@sf) {
|
||||
next if ($sf eq "." || $sf eq "..");
|
||||
local $path = "$dir/$sf";
|
||||
if (-l $path || !-d $path) {
|
||||
push(@rv, $path);
|
||||
}
|
||||
elsif (-d $sf) {
|
||||
push(@rv, &expand_directory($path));
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user