migrate to getLineageIterator to save memory
This commit is contained in:
parent
cc87552a22
commit
2c75ab27e6
34 changed files with 794 additions and 187 deletions
|
|
@ -315,11 +315,17 @@ sub deleteAttribute {
|
|||
[$attributeId,$self->getId]);
|
||||
|
||||
# recalculate scores for MatrixListings
|
||||
my @listings = @{ $self->getLineage(['descendants'], {
|
||||
my $listingIter = $self->getLineageIterator(['descendants'], {
|
||||
includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
|
||||
returnObjects => 1,
|
||||
}) };
|
||||
foreach my $listing (@listings){
|
||||
});
|
||||
while ( 1 ) {
|
||||
my $listing;
|
||||
eval { $listing = $listingIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $listing;
|
||||
$listing->updateScore;
|
||||
}
|
||||
|
||||
|
|
@ -661,17 +667,23 @@ sub view {
|
|||
|
||||
if ($self->canEdit){
|
||||
# Get all the MatrixListings that are still pending.
|
||||
my @pendingListings = @{ $self->getLineage(['descendants'], {
|
||||
my $pendingIter = $self->getLineageIterator(['descendants'], {
|
||||
includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
|
||||
orderByClause => "revisionDate asc",
|
||||
returnObjects => 1,
|
||||
statusToInclude => ['pending'],
|
||||
}) };
|
||||
foreach my $pendingListing (@pendingListings){
|
||||
});
|
||||
while ( 1 ) {
|
||||
my $pending;
|
||||
eval { $pending = $pendingIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $pending;
|
||||
push (@{ $var->{pending_loop} }, {
|
||||
url => $pendingListing->getUrl
|
||||
."?func=view;revision=".$pendingListing->get('revisionDate'),
|
||||
name => $pendingListing->get('title'),
|
||||
url => $pending->getUrl
|
||||
."?func=view;revision=".$pending->get('revisionDate'),
|
||||
name => $pending->get('title'),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -747,18 +759,23 @@ sub view {
|
|||
|
||||
# Get the 5 MatrixListings that were last updated as objects using getLineage.
|
||||
|
||||
my @lastUpdatedListings = @{ $self->getLineage(['descendants'], {
|
||||
my $lastUpdatedIter = $self->getLineageIterator(['descendants'], {
|
||||
includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
|
||||
joinClass => "WebGUI::Asset::MatrixListing",
|
||||
orderByClause => "lastUpdated desc",
|
||||
limit => 5,
|
||||
returnObjects => 1,
|
||||
}) };
|
||||
foreach my $lastUpdatedListing (@lastUpdatedListings){
|
||||
});
|
||||
for ( 1..5 ) {
|
||||
my $lastUpdated;
|
||||
eval { $lastUpdated = $lastUpdatedIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $lastUpdated;
|
||||
push (@{ $varStatistics->{last_updated_loop} }, {
|
||||
url => $lastUpdatedListing->getUrl,
|
||||
name => $lastUpdatedListing->get('title'),
|
||||
lastUpdated => $session->datetime->epochToHuman($lastUpdatedListing->get('lastUpdated'),"%z")
|
||||
url => $lastUpdated->getUrl,
|
||||
name => $lastUpdated->get('title'),
|
||||
lastUpdated => $session->datetime->epochToHuman($lastUpdated->get('lastUpdated'),"%z")
|
||||
});
|
||||
}
|
||||
$varStatistics->{lastUpdated_sortButton} = "<span id='sortByUpdated'><button type='button'>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue