Fixed an unhandled exception in Workflow/Activity/PurgeOldAssetRevisions.pm

This commit is contained in:
JT Smith 2007-04-11 14:36:13 +00:00
parent 025a66e30d
commit e8afd2ad72
2 changed files with 8 additions and 3 deletions

View file

@ -79,9 +79,13 @@ sub execute {
my $sth = $self->session->db->read("select assetData.assetId,asset.className,assetData.revisionDate from asset left join assetData on asset.assetId=assetData.assetId where assetData.revisionDate<? order by assetData.revisionDate asc", [time() - $self->get("purgeAfter")]);
while (my ($id, $class, $version) = $sth->array) {
my $asset = WebGUI::Asset->new($self->session, $id,$class,$version);
if ($asset->getRevisionCount("approved") > 1) {
$asset->purgeRevision;
}
if (defined $asset) {
if ($asset->getRevisionCount("approved") > 1) {
$asset->purgeRevision;
}
} else {
$self->session->errorHandler->error("Could not instanciate asset $id $class $version perhaps it is corrupt.")
}
}
$sth->finish;
return $self->COMPLETE;