]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use sitemap_notice_count in sitemap index
authorEvan Prodromou <evan@status.net>
Mon, 31 May 2010 14:50:27 +0000 (07:50 -0700)
committerEvan Prodromou <evan@status.net>
Tue, 1 Jun 2010 20:52:28 +0000 (13:52 -0700)
plugins/Sitemap/sitemapindex.php

index a3328340fe83acd2f0e687ab1e4bb46d6d6e24ed..5150b1aeb8bd7aab7a487e10543fa123c5ae9974 100644 (file)
@@ -58,8 +58,8 @@ class SitemapindexAction extends Action
 
         $this->elementStart('sitemapindex', array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'));
 
-        $this->showUserSitemaps();
         $this->showNoticeSitemaps();
+        $this->showUserSitemaps();
 
         $this->elementEnd('sitemapindex');
 
@@ -89,7 +89,9 @@ class SitemapindexAction extends Action
 
     function showNoticeSitemaps()
     {
-        $noticeCounts = $this->getNoticeCounts();
+        $noticeCounts = Sitemap_notice_count::getAll();
+
+        common_debug(sprintf("Got %d notice counts", count($noticeCounts)));
 
         foreach ($noticeCounts as $dt => $cnt) {
             if ($cnt == 0) {
@@ -105,37 +107,6 @@ class SitemapindexAction extends Action
         }
     }
 
-    function getUserCounts()
-    {
-        return Sitemap_user_count::getAll();
-    }
-
-    function getNoticeCounts()
-    {
-        $noticeCounts = Notice::cacheGet('sitemap:notice:counts');
-
-        if ($noticeCounts === false) {
-
-            $notice = new Notice();
-
-            $notice->selectAdd();
-            $notice->selectAdd('date(created) as postdate, count(*) as postcount');
-            $notice->groupBy('postdate');
-
-            $notice->find();
-
-            $noticeCounts = array();
-
-            while ($notice->fetch()) {
-                $noticeCounts[$notice->postdate] = $notice->postcount;
-            }
-
-            Notice::cacheSet('sitemap:notice:counts', $noticeCounts);
-        }
-
-        return $noticeCounts;
-    }
-
     function showSitemap($prefix, $dt, $i)
     {
         list($y, $m, $d) = explode('-', $dt);