/** * Generate a FeedItem object from a given revision table row * Borrows Recent Changes' feed generation functions for formatting; * includes a diff to the previous revision (if any). * * @param stdClass|array $row Database row * @return FeedItem */ function feedItem($row) { $rev = new Revision($row); $rev->setTitle($this->getTitle()); $text = FeedUtils::formatDiffRow($this->getTitle(), $this->getTitle()->getPreviousRevisionID($rev->getId()), $rev->getId(), $rev->getTimestamp(), $rev->getComment()); if ($rev->getComment() == '') { global $wgContLang; $title = $this->msg('history-feed-item-nocomment', $rev->getUserText(), $wgContLang->timeanddate($rev->getTimestamp()), $wgContLang->date($rev->getTimestamp()), $wgContLang->time($rev->getTimestamp()))->inContentLanguage()->text(); } else { $title = $rev->getUserText() . $this->msg('colon-separator')->inContentLanguage()->text() . FeedItem::stripComment($rev->getComment()); } return new FeedItem($title, $text, $this->getTitle()->getFullURL('diff=' . $rev->getId() . '&oldid=prev'), $rev->getTimestamp(), $rev->getUserText(), $this->getTitle()->getTalkPage()->getFullURL()); }
protected function feedItem($row) { $title = Title::MakeTitle($row->page_namespace, $row->page_title); if ($title) { $date = $row->pending_since; $comments = $title->getTalkPage()->getFullURL(); $curRev = Revision::newFromTitle($title); return new FeedItem($title->getPrefixedText(), FeedUtils::formatDiffRow($title, $row->stable, $curRev->getId(), $row->pending_since, $curRev->getComment()), $title->getFullURL(), $date, $curRev->getUserText(), $comments); } else { return null; } }