merging 6.7.8 changes and bug fixes

This commit is contained in:
JT Smith 2005-11-30 20:33:40 +00:00
parent 4bd429bcac
commit fdfb9bf5ae
8 changed files with 95 additions and 58 deletions

View file

@ -760,7 +760,7 @@ sub setStatusApproved {
$self->commit;
$self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if $self->isReply;
unless ($self->isPoster) {
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->getUrl,579);
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',WebGUI::URL::getSiteUrl().'/'.$self->getUrl,579);
}
$self->notifySubscribers unless ($session{form}{func} eq 'add');
}
@ -793,7 +793,7 @@ Sets the status of this post to denied.
sub setStatusDenied {
my ($self) = @_;
$self->update({status=>'denied'});
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->getUrl,580);
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',WebGUI::URL::getSiteUrl().'/'.$self->getUrl,580);
}
#-------------------------------------------------------------------
@ -811,7 +811,7 @@ sub setStatusPending {
} else {
$self->update({status=>'pending'});
WebGUI::MessageLog::addInternationalizedEntry('',$self->getThread->getParent->get("moderateGroupId"),
$self->getUrl("revision=".$self->get("revisionDate")),578,'WebGUI','pending');
WebGUI::URL::getSiteUrl().'/'.$self->getUrl("revision=".$self->get("revisionDate")),578,'WebGUI','pending');
}
}

View file

@ -18,6 +18,7 @@ package WebGUI::Cache::FileCache;
use Storable qw(nstore retrieve);
use WebGUI::Session;
use File::Path;
use File::Find;
our @ISA = qw(WebGUI::Cache);
@ -166,34 +167,33 @@ Returns the size (in bytes) of the current cache under this namespace. Consequen
=cut
#-------------------------------------------------------------------
=head2 getNamespaceSize ( )
Returns the size (in bytes) of the current cache under this namespace. Consequently it also cleans up expired cache items.
=cut
sub getNamespaceSize {
my $self = shift;
my $expiresModifier = shift || 0;
my $path = shift || $self->getNamespaceRoot;
my $filesRemaining = 0;
if (opendir(DIR,$path)) {
my @files = readdir(DIR);
foreach my $file (@files) {
unless ($file eq "." || $file eq "..") {
if (open(FILE,"<".$path."/expires")) {
$session{cacheSize} = 0;
File::Find::find({no_chdir=>1, wanted=> sub {
return unless $File::Find::name =~ m/^(.*)expires$/;
my $dir = $1;
if (open(FILE,"<".$dir."/expires")) {
my $expires = <FILE>;
close(FILE);
if ($expires < time()+$expiresModifier) {
if (-e $path) {
rmtree($path);
}
rmtree($dir);
} else {
my (@attributes) = stat($path.'/'.$file);
$filesRemaining += $attributes[7];
$session{cacheSize} += -s $dir.'cache';
}
} else {
$filesRemaining += $self->getNamespaceSize($expiresModifier,$path."/".$file);
}
}
}
closedir(DIR);
}
return $filesRemaining;
}, $self->getNamespaceRoot);
return $session{cacheSize};
}
#-------------------------------------------------------------------