1) Fixed a bad module name that prevented the updated WeatherData from running.
2) Heavy refactor of getAssetsInClipboard to make it use getLineage instead of custom SQL. Made Workflow/Activity/TrashClipboard use the same method. Updated getLineage so that the whereClause key must not only exist, but actually have something in it. Otherwise it generates an empty pair of parens, which is a SQL error.
This commit is contained in:
parent
70e156542a
commit
c3052fcd67
5 changed files with 39 additions and 38 deletions
|
|
@ -17,6 +17,8 @@ package WebGUI::Workflow::Activity::TrashClipboard;
|
|||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::AssetClipboard;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -74,13 +76,12 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $expireDate = (time()-$self->get("trashAfter"));
|
||||
my $sth = $self->session->db->read("select assetId,className from asset where state='clipboard' and stateChanged < ?", [$expireDate]);
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->new($self->session,$id,$class);
|
||||
my $self = shift;
|
||||
my $expireDate = (time()-$self->get("trashAfter"));
|
||||
my $root = WebGUI::Asset->getRoot($self->session);
|
||||
foreach my $asset ( @{ $root->getAssetsInClipboard('', '', $expireDate) } ) {
|
||||
$asset->trash;
|
||||
}
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue