summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-04-12 11:28:41 -0400
committerEvan Prodromou <evan@status.net>2010-06-01 13:52:27 -0700
commit610d8021d8653822dbc52f0790eee41e4db38c17 (patch)
tree07d48b7e93b5dac592778306b4c975b138b9e26f /plugins
parent8b9ce731f4707f6939497d139521acee56596dea (diff)
use an array for notice sitemap
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Sitemap/noticesitemap.php58
1 files changed, 39 insertions, 19 deletions
diff --git a/plugins/Sitemap/noticesitemap.php b/plugins/Sitemap/noticesitemap.php
index c8db24efe..6cf2b3d01 100644
--- a/plugins/Sitemap/noticesitemap.php
+++ b/plugins/Sitemap/noticesitemap.php
@@ -43,7 +43,8 @@ if (!defined('STATUSNET')) {
class NoticesitemapAction extends SitemapAction
{
- var $notice = null;
+ var $notices = null;
+ var $j = 0;
function prepare($args)
{
@@ -61,10 +62,32 @@ class NoticesitemapAction extends SitemapAction
$d += 0;
$i += 0;
+ $this->notices = $this->getNotices($y, $m, $d, $i);
+ $this->j = 0;
+
+ return true;
+ }
+
+ function nextUrl()
+ {
+ if ($this->j < count($this->notices)) {
+ $n = $this->notices[$this->j];
+ $this->j++;
+ return array(common_local_url('shownotice', array('notice' => $n[0])),
+ common_date_w3dtf($n[1]),
+ null,
+ null);
+ } else {
+ return null;
+ }
+ }
+
+ function getNotices($y, $m, $d, $i)
+ {
$offset = ($i-1) * SitemapPlugin::NOTICES_PER_MAP;
$limit = SitemapPlugin::NOTICES_PER_MAP;
- $this->notice = new Notice();
+ $notice = new Notice();
$begindt = sprintf('%04d-%02d-%02d 00:00:00', $y, $m, $d);
@@ -74,29 +97,26 @@ class NoticesitemapAction extends SitemapAction
$enddt = common_sql_date(strtotime($begindt) + (24 * 60 * 60));
- $this->notice->whereAdd("created >= '$begindt'");
- $this->notice->whereAdd("created < '$enddt'");
+ $notice->selectAdd();
+ $notice->selectAdd('id, created');
- $this->notice->whereAdd('is_local != 0');
+ $notice->whereAdd("created >= '$begindt'");
+ $notice->whereAdd("created < '$enddt'");
- $this->notice->orderBy('created');
+ $notice->whereAdd('is_local != 0');
- $this->notice->limit($offset, $limit);
+ $notice->orderBy('created');
- $this->notice->find();
+ $notice->limit($offset, $limit);
- return true;
- }
+ $notice->find();
- function nextUrl()
- {
- if ($this->notice->fetch()) {
- return array(common_local_url('shownotice', array('notice' => $this->notice->id)),
- common_date_w3dtf($this->notice->created),
- null,
- null);
- } else {
- return null;
+ $n = array();
+
+ while ($notice->fetch()) {
+ $n[] = array($notice->id, $notice->created);
}
+
+ return $n;
}
}