Children of the site tree are no longer listed only for the purpose of counting them. count($this->Children()) creates an array list of children which has serious performance consequences if there are lot of children present. On the other hand $this->numChildren() runs a count query which is much faster and eat’s less memory.

This commit is contained in:
Mojmir Fendek 2017-06-08 12:19:27 +12:00
parent a24a3af1b1
commit b442bad767

View File

@ -1956,7 +1956,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
'CMSMain.NEWPAGE',
array('pagetype' => $this->i18n_singular_name())
)));
$helpText = (self::config()->nested_urls && count($this->Children())) ? $this->fieldLabel('LinkChangeNote') : '';
$helpText = (self::config()->nested_urls && $this->numChildren()) ? $this->fieldLabel('LinkChangeNote') : '';
if(!Config::inst()->get('URLSegmentFilter', 'default_allow_multibyte')) {
$helpText .= $helpText ? '<br />' : '';
$helpText .= _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.');