/** * Actually output a feed. * @param ChannelFeed $feed Feed object. * @param $res Result of sql query */ private function makeFeed($feed, $res) { global $wgGNSMcommentNamespace; $feed->outHeader(); foreach ($res as $row) { $title = Title::makeTitle($row->page_namespace, $row->page_title); if (!$title) { $feed->outFooter(); return; } // @todo FIXME: Under what circumstance would cl_timestamp not be set? // possibly worth an exception if that happens. $pubDate = isset($row->cl_timestamp) ? $row->cl_timestamp : wfTimestampNow(); $feedItem = new FeedSMItem($title, $pubDate, $this->getKeywords($title), $wgGNSMcommentNamespace); $feed->outItem($feedItem); } $feed->outFooter(); }
/** * Generate the feed items given a row from the database, printing the feed. * @param object $rows DatabaseBase resource with recentchanges rows * @param ChannelFeed $feed */ public static function generateFeed($rows, &$feed) { $items = self::buildItems($rows); $feed->outHeader(); foreach ($items as $item) { $feed->outItem($item); } $feed->outFooter(); }