mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
Update DBDatetime API use. (Fixes #146)
This commit is contained in:
parent
a0a8c34d2f
commit
572da5fa8a
@ -125,11 +125,16 @@ class GoogleSitemapExtension extends DataExtension
|
||||
$now->value = $date;
|
||||
|
||||
$versions = ($this->owner->Version) ? $this->owner->Version : 1;
|
||||
$timediff = $now->format('U') - $created->format('U');
|
||||
|
||||
// Check how many revisions have been made over the lifetime of the
|
||||
// Page for a rough estimate of it's changing frequency.
|
||||
$period = $timediff / ($versions + 1);
|
||||
if ($now && $created) {
|
||||
$timediff = $now->getTimestamp() - $created->getTimestamp();
|
||||
|
||||
// Check how many revisions have been made over the lifetime of the
|
||||
// Page for a rough estimate of it's changing frequency.
|
||||
$period = $timediff / ($versions + 1);
|
||||
} else {
|
||||
$period = 0;
|
||||
}
|
||||
|
||||
if ($period > 60 * 60 * 24 * 365) {
|
||||
$freq = 'yearly';
|
||||
|
Loading…
Reference in New Issue
Block a user