migrate to getLineageIterator to save memory
This commit is contained in:
parent
cc87552a22
commit
2c75ab27e6
34 changed files with 794 additions and 187 deletions
|
|
@ -122,7 +122,15 @@ Overridden to check the revision dates of children as well
|
|||
sub getContentLastModified {
|
||||
my $self = shift;
|
||||
my $mtime = $self->get("revisionDate");
|
||||
foreach my $child (@{ $self->getLineage(["children"],{returnObjects=>1}) }) {
|
||||
my $childIter = $self->getLineageIterator(["children"]);
|
||||
while ( 1 ) {
|
||||
my $child;
|
||||
eval { $child = $childIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $child;
|
||||
my $child_mtime = $child->getContentLastModified;
|
||||
$mtime = $child_mtime if ($child_mtime > $mtime);
|
||||
}
|
||||
|
|
@ -233,7 +241,7 @@ sub view {
|
|||
my $vars = $self->getTemplateVars;
|
||||
# TODO: Getting the children template vars should be a seperate method.
|
||||
|
||||
my %rules = ( returnObjects => 1);
|
||||
my %rules = ( );
|
||||
if ( $self->get( "sortAlphabetically" ) ) {
|
||||
$rules{ orderByClause } = "assetData.title " . $self->get( "sortOrder" );
|
||||
}
|
||||
|
|
@ -241,9 +249,16 @@ sub view {
|
|||
$rules{ orderByClause } = "asset.lineage " . $self->get( "sortOrder" );
|
||||
}
|
||||
|
||||
my $children = $self->getLineage( ["children"], \%rules);
|
||||
foreach my $child ( @{ $children } ) {
|
||||
# TODO: Instead of this it should be using $child->getTemplateVars || $child->get
|
||||
my $childIter = $self->getLineageIterator( ["children"], \%rules);
|
||||
while ( 1 ) {
|
||||
my $child;
|
||||
eval { $child = $childIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $child;
|
||||
# TODO: Instead of this it should be using $child->getTemplateVars || $child->get
|
||||
if ( $child->isa("WebGUI::Asset::Wobject::Folder") ) {
|
||||
push @{ $vars->{ "subfolder_loop" } }, {
|
||||
id => $child->getId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue