Make sure SiteTree sitemap index uses correct last edited value.

This commit is contained in:
Jyrki Lilja 2013-11-08 11:25:27 +02:00
parent a2297c43ef
commit 937d820d95

View File

@ -271,10 +271,16 @@ class GoogleSitemap {
for($i = 1; $i <= $neededForPage; $i++) {
$sliced = $instances
->limit($countPerFile, ($i - 1) * $countPerFile)
->last();
->limit($countPerFile, ($i - 1) * $countPerFile);
$lastEdited = null;
$lastModified = ($sliced) ? $sliced->dbObject('LastEdited')->Format('Y-m-d') : date('Y-m-d');
foreach ($sliced as $page) {
if ($page->dbObject('LastEdited') > $lastEdited) {
$lastEdited = $page->dbObject('LastEdited');
}
}
$lastModified = ($lastEdited) ? $lastEdited->Format('Y-m-d') : date('Y-m-d');
$sitemaps->push(new ArrayData(array(
'ClassName' => 'SiteTree',