refactored storage api to handle new session stuff

This commit is contained in:
JT Smith 2006-01-12 19:15:34 +00:00
parent 02c5a65857
commit 1e5034acd6
11 changed files with 84 additions and 45 deletions

View file

@ -57,7 +57,7 @@ sub addRevision {
my $self = shift;
my $newSelf = $self->SUPER::addRevision(@_);
if ($self->get("storageId")) {
my $newStorage = WebGUI::Storage->get($self->get("storageId"))->copy;
my $newStorage = WebGUI::Storage->get($self->session,$self->get("storageId"))->copy;
$newSelf->update({storageId=>$newStorage->getId});
}
return $newSelf;
@ -184,7 +184,7 @@ sub getStorageLocation {
$self->{_storageLocation} = WebGUI::Storage->create;
$self->update({storageId=>$self->{_storageLocation}->getId});
} else {
$self->{_storageLocation} = WebGUI::Storage->get($self->get("storageId"));
$self->{_storageLocation} = WebGUI::Storage->get($self->session,$self->get("storageId"));
}
}
return $self->{_storageLocation};
@ -216,7 +216,7 @@ sub purge {
my $self = shift;
my $sth = $self->session->db->read("select storageId from FileAsset where assetId=".$self->session->db->quote($self->getId));
while (my ($storageId) = $sth->array) {
WebGUI::Storage->get($storageId)->delete;
WebGUI::Storage->get($self->session,$storageId)->delete;
}
$sth->finish;
return $self->SUPER::purge;