Storage now prunes empty directories when delete is called.
Add use WebGUI::Form::Hidden to Form::File
This commit is contained in:
parent
e136fb5b4e
commit
f413c029a2
4 changed files with 26 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use base 'WebGUI::Form::Control';
|
||||
use WebGUI::International;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Form::Hidden;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,19 @@ Deletes this storage location and its contents (if any) from the filesystem.
|
|||
sub delete {
|
||||
my $self = shift;
|
||||
my $path = $self->getPath;
|
||||
rmtree($path) if ($path);
|
||||
if ($path) {
|
||||
rmtree($path) if ($path);
|
||||
foreach my $subDir ($self->{_part1}.'/'.$self->{_part2}, $self->{_part1}) {
|
||||
my $uDir = $self->session->config->get('uploadsPath') . '/' . $subDir;
|
||||
opendir my $DH, $uDir or
|
||||
$self->session->errorHandler->fatal("Unable to open $uDir for directory reading");
|
||||
my @dirs = grep { !/^\.+$/ } readdir($DH);
|
||||
if (scalar @dirs == 0) {
|
||||
rmtree($uDir);
|
||||
}
|
||||
close $DH;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue