]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better calculation for end date in notice sitemaps
authorEvan Prodromou <evan@status.net>
Mon, 12 Apr 2010 14:11:18 +0000 (10:11 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 1 Jun 2010 20:52:27 +0000 (13:52 -0700)
plugins/Sitemap/noticesitemap.php

index 0024084863964c17e89991f55ebff65e83072e18..12a22dbb22a6e40201272594058ea7b0c8d8e2d6 100644 (file)
@@ -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();