Storage now prunes empty directories when delete is called.

Add use WebGUI::Form::Hidden to Form::File
This commit is contained in:
Colin Kuskie 2006-05-19 21:48:10 +00:00
parent e136fb5b4e
commit f413c029a2
4 changed files with 26 additions and 2 deletions

View file

@ -4,12 +4,15 @@
- fixed a bug in the project management app that was causing a no privilege error when trying to display the view.
- fixed various bugs in the project management app.
- added right click ment to project management app.
- If a storage object is deleted, it will prune the directory structure
upward if the directories are empty, until it reaches the uploads dir.
- fix [ 1489017 ] Changing default time zone can disable site
- fix [ 1490812 ] Events cannot be purged.
- fix [ 1466902 ] $u->status('Deactivated') does not expire existing sessions
- fix - msgs with only text/html not accepted as such
- fix - getCsMail doesn't recognize References
- Added duplicate button in asset manager as discussed in Community IRC.
- fix - WebGUI::Form::File doesn't use WebGUI::Form::Hidden
6.99.1
- Bugfixes on dashboard to fix template errors.

View file

@ -18,6 +18,7 @@ use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Storage;
use WebGUI::Form::Hidden;
=head1 NAME

View file

@ -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;
}

View file

@ -11,6 +11,7 @@
use FindBin;
use strict;
use lib "$FindBin::Bin/lib";
our $todo;
use WebGUI::Test;
use WebGUI::Session;
@ -18,7 +19,7 @@ use WebGUI::Storage;
use Test::More;
plan tests => 8; # increment this value for each test you create
plan tests => 9; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -48,6 +49,13 @@ $storage1->delete;
ok( !(-e $storageDir1), "Storage location deleted");
undef $storage1;
TODO: {
local $TODO = "Tests to make later";
ok(0, 'Create object with 1 character GUID');
}
END {
ref $storage1 eq "WebGUI::Storage" and $storage1->delete;
}