FIX/NEW for #90 Extending alterDataList after both Versioned::get_by_stage() and also new DataList(). No list left behind!

This commit is contained in:
Patrick Nelson 2015-10-12 17:23:01 -04:00
parent e2a1dc5250
commit a641ded926

View File

@ -204,7 +204,6 @@ class GoogleSitemap extends Object {
if($class == "SiteTree") {
$filter = ($filter) ? "\"ShowInSearch\" = 1" : "";
$instances = Versioned::get_by_stage('SiteTree', 'Live', $filter);
$this->extend("alterDataList", $instances, $class);
}
else if($class == "GoogleSitemapRoute") {
$instances = array_slice(self::$routes, ($page - 1) * $count, $count);
@ -226,6 +225,8 @@ class GoogleSitemap extends Object {
$instances = new DataList($class);
}
$this->extend("alterDataList", $instances, $class);
$instances = $instances->limit(
$count,
($page - 1) * $count
@ -341,7 +342,7 @@ class GoogleSitemap extends Object {
foreach(self::$dataobjects as $class => $config) {
$list = new DataList($class);
$list = $list->sort('LastEdited ASC');
$this->extend("alterDataList", $list, $class);
$neededForClass = ceil($list->count() / $countPerFile);
for($i = 1; $i <= $neededForClass; $i++) {