Skip to content

Commit

Permalink
BUGFIX Aborting marking in Hierarchy->markPartialTree() before loadin…
Browse files Browse the repository at this point in the history
…g nodes, if the expected node count would exceed the totals (regardless of the in-memory marking state)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114133 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Nov 24, 2010
1 parent 3ffa3bf commit f1bf0d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/model/Hierarchy.php
Expand Up @@ -100,6 +100,10 @@ public function markPartialTree($minNodeCount = 30, $context = null, $childrenMe

// foreach can't handle an ever-growing $nodes list
while(list($id, $node) = each($this->markedNodes)) {
// Inspect the number of potential nodes to mark - if its more than the minimum count,
// don't query them in the first place to inspect further marking state in-memory
if((sizeof($this->markedNodes) + $node->$numChildrenMethod()) >= $minNodeCount) break;

$this->markChildren($node, $context, $childrenMethod, $numChildrenMethod);
if($minNodeCount && sizeof($this->markedNodes) >= $minNodeCount) {
break;
Expand Down

0 comments on commit f1bf0d0

Please sign in to comment.