more versioning bug fixes
This commit is contained in:
parent
e9f74cdc0f
commit
abf4076569
5 changed files with 107 additions and 74 deletions
|
|
@ -39,6 +39,24 @@ our @ISA = qw(WebGUI::Asset);
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 addRevision
|
||||
|
||||
Override the default method in order to deal with attachments.
|
||||
|
||||
=cut
|
||||
|
||||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
if ($self->get("storageId")) {
|
||||
my $newStorage = WebGUI::Storage->get($self->get("storageId"))->copy;
|
||||
$newSelf->update({storageId=>$newStorage->getId});
|
||||
}
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canAdd {
|
||||
my $class = shift;
|
||||
|
|
@ -661,6 +679,30 @@ sub processPropertiesFromFormPost {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = WebGUI::SQL->read("select storageId from FileAsset where assetId=".quote($self->getId));
|
||||
while (my ($storageId) = $sth->array) {
|
||||
WebGUI::Storage->get($storageId)->delete;
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("delete from Post_rating where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Post_read where postId=".quote($self->getId));
|
||||
return $self->SUPER::purge;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub purgeRevision {
|
||||
my $self = shift;
|
||||
$self->getStorageLocation->delete;
|
||||
return $self->SUPER::purgeRevision;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 rate ( rating )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue