diff options
author | Evan Prodromou <evan@status.net> | 2010-05-21 16:47:30 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-06-01 13:52:28 -0700 |
commit | 416161c94366292a623aecf8fe79b0d73c337e98 (patch) | |
tree | 51cdfd9e5e84999d6358666929f576a1430c549c /plugins/Sitemap/sitemapindex.php | |
parent | 7d85b79814e7e91a88f23d7c7e752a0bcfc83ff4 (diff) |
make user counts use the database table
Diffstat (limited to 'plugins/Sitemap/sitemapindex.php')
-rw-r--r-- | plugins/Sitemap/sitemapindex.php | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/plugins/Sitemap/sitemapindex.php b/plugins/Sitemap/sitemapindex.php index 2055dd7f0..a3328340f 100644 --- a/plugins/Sitemap/sitemapindex.php +++ b/plugins/Sitemap/sitemapindex.php @@ -68,11 +68,15 @@ class SitemapindexAction extends Action function showUserSitemaps() { - $userCounts = $this->getUserCounts(); + $userCounts = Sitemap_user_count::getAll(); foreach ($userCounts as $dt => $cnt) { $cnt = $cnt+0; - assert($cnt != 0); + + if ($cnt == 0) { + continue; + } + $n = (int)$cnt / (int)SitemapPlugin::USERS_PER_MAP; if (($cnt % SitemapPlugin::USERS_PER_MAP) != 0) { $n++; @@ -88,7 +92,9 @@ class SitemapindexAction extends Action $noticeCounts = $this->getNoticeCounts(); foreach ($noticeCounts as $dt => $cnt) { - assert($cnt != 0); + if ($cnt == 0) { + continue; + } $n = $cnt / SitemapPlugin::NOTICES_PER_MAP; if ($cnt % SitemapPlugin::NOTICES_PER_MAP) { $n++; @@ -101,28 +107,7 @@ class SitemapindexAction extends Action function getUserCounts() { - $userCounts = User::cacheGet('sitemap:user:counts'); - - if ($userCounts === false) { - - $user = new User(); - - $user->selectAdd(); - $user->selectAdd('date(created) as regdate, count(*) as regcount'); - $user->groupBy('regdate'); - - $user->find(); - - $userCounts = array(); - - while ($user->fetch()) { - $userCounts[$user->regdate] = $user->regcount; - } - - User::cacheSet('sitemap:user:counts', $userCounts); - } - - return $userCounts; + return Sitemap_user_count::getAll(); } function getNoticeCounts() |