diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index b3f17d0712..632714551f 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -172,21 +172,12 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction */ function getNotices() { - $notices = array(); + $notice = Notice_tag::getStream($this->tag)->getNotices(($this->page - 1) * $this->count, + $this->count + 1, + $this->since_id, + $this->max_id); - $notice = Notice_tag::getStream( - $this->tag, - ($this->page - 1) * $this->count, - $this->count + 1, - $this->since_id, - $this->max_id - ); - - while ($notice->fetch()) { - $notices[] = clone($notice); - } - - return $notices; + return $notice->fetchAll(); } /** diff --git a/actions/tag.php b/actions/tag.php index 09de8b3c25..751e8dcec5 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -46,7 +46,8 @@ class TagAction extends ManagedAction common_set_returnto($this->selfUrl()); - $this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); + $this->notice = Notice_tag::getStream($this->tag)->getNotices(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); if($this->page > 1 && $this->notice->N == 0){ // TRANS: Client error when page not found (404). diff --git a/actions/tagrss.php b/actions/tagrss.php index 468944d11f..8a1494f131 100644 --- a/actions/tagrss.php +++ b/actions/tagrss.php @@ -47,12 +47,8 @@ class TagrssAction extends Rss10Action return null; } - $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit); - while ($notice->fetch()) { - $notices[] = clone($notice); - } - - return $notices; + $notice = Notice_tag::getStream($tag->tag)->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit); + return $notice->fetchAll(); } function getChannel() diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index 3d7658a1ac..b864de8009 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -56,8 +56,7 @@ class Notice_tag extends Managed_DataObject static function getStream($tag, $offset=0, $limit=20, $sinceId=0, $maxId=0) { $stream = new TagNoticeStream($tag); - - return $stream->getNotices($offset, $limit, $sinceId, $maxId); + return $stream; } function blowCache($blowLast=false)