Pre-cache page version numbers when querying CMS tree for query efficiency

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@69982 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-01-12 02:45:48 +00:00
parent 9274c1f234
commit 508aa8a80b

View File

@ -149,6 +149,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$this->generateDataTreeHints();
$this->generateTreeStylingJS();
// Pre-cache sitetree version numbers for querying efficiency
Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
return $this->getSiteTreeFor("SiteTree");
}
@ -175,6 +179,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* Returns a filtered Site Tree
*/
public function filtersitetree() {
// Pre-cache sitetree version numbers for querying efficiency
Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
$className = 'SiteTree';
$rootID = null;
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);