Skip to content

Commit

Permalink
FIX: Use Hierarchy::prepopulateTreeDataCache() in CMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Minnee committed Sep 21, 2018
1 parent 95fae36 commit 4369585
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,11 @@ public function LinkPreview()
*/
public function SiteTreeAsUL()
{
// Pre-cache sitetree version numbers for querying efficiency
Versioned::prepopulate_versionnumber_cache(SiteTree::class, Versioned::DRAFT);
Versioned::prepopulate_versionnumber_cache(SiteTree::class, Versioned::LIVE);

if (method_exists(Hierarchy::class, 'prepopulate_numchildren_cache')) {
Hierarchy::prepopulate_numchildren_cache(SiteTree::class, Versioned::DRAFT);
}
$filter = $this->getSearchFilter();
SiteTree::singleton()->prepopulateTreeDataCache(null, [
'childrenMethod' => $filter ? $filter->getChildrenMethod() : 'AllChildrenIncludingDeleted',
'numChildrenMethod' => $filter ? $filter->getNumChildrenMethod() : 'numChildren',
]);

$html = $this->getSiteTreeFor($this->config()->get('tree_class'));

Expand Down

0 comments on commit 4369585

Please sign in to comment.