From 42cb0820a27285542d4938e03917f01eefd26eb2 Mon Sep 17 00:00:00 2001 From: Mojmir Fendek Date: Wed, 5 Jul 2017 10:03:10 +1200 Subject: [PATCH] Limits added to collateDescendants() to ensure reasonable performance with thousands of pages. --- code/Model/SiteTree.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 55592efb..23878d8d 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -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) {