summaryrefslogtreecommitdiff
path: root/plugins/Sitemap
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-04-12 10:11:18 -0400
committerEvan Prodromou <evan@status.net>2010-06-01 13:52:27 -0700
commit9fdafaf07e0ef90e378c6a3e81dbcf60e31c2cac (patch)
treeec9556144df032ed6eb07c9a9b4953a735f07c54 /plugins/Sitemap
parent35272f638c0f162f43c951e1ffcef55c8f54787e (diff)
better calculation for end date in notice sitemaps
Diffstat (limited to 'plugins/Sitemap')
-rw-r--r--plugins/Sitemap/noticesitemap.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/Sitemap/noticesitemap.php b/plugins/Sitemap/noticesitemap.php
index 002408486..12a22dbb2 100644
--- a/plugins/Sitemap/noticesitemap.php
+++ b/plugins/Sitemap/noticesitemap.php
@@ -68,14 +68,21 @@ class NoticesitemapAction extends SitemapAction
$this->notice = new Notice();
- $dt = sprintf('%04d-%02d-%02d', $y, $m, $d);
+ $begindt = sprintf('%04d-%02d-%02d 00:00:00', $y, $m, $d);
- $this->notice->whereAdd("created > '$dt 00:00:00'");
- $this->notice->whereAdd("created <= '$dt 23:59:59'");
+ // XXX: estimates 1d == 24h, which screws up days
+ // with leap seconds (1d == 24h + 1s). Thankfully they're
+ // few and far between.
+
+ $enddt = common_sql_date(strtotime($begindt) + (24 * 60 * 60));
+
+ $this->notice->whereAdd("created >= '$begindt'");
+ $this->notice->whereAdd("created < '$enddt'");
$this->notice->whereAdd('is_local != 0');
- $this->notice->orderBy('id');
+ $this->notice->orderBy('created');
+
$this->notice->limit($offset, $limit);
$this->notice->find();