Limits added to collateDescendants() to ensure reasonable performance with thousands of pages.

This commit is contained in:
Mojmir Fendek 2017-07-05 10:03:10 +12:00 committed by Daniel Hensby
parent 184ec65b7f
commit 42cb0820a2
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -1256,6 +1256,12 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
*/
public function collateDescendants($condition, &$collator)
{
// apply reasonable hierarchy limits
$threshold = Config::inst()->get(Hierarchy::class, 'node_threshold_leaf');
if ($this->numChildren() > $threshold) {
return false;
}
$children = $this->Children();
if ($children) {
foreach ($children as $item) {