getMain() ); } public function execute() { $params = $this->extractRequestParams(); global $wgFeed, $wgFeedClasses, $wgSitename, $wgLanguageCode; if( !$wgFeed ) { $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' ); } if( !isset( $wgFeedClasses[ $params['feedformat'] ] ) ) { $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' ); } global $wgMiserMode; if ( $params['showsizediff'] && $wgMiserMode ) { $this->dieUsage( 'Size difference is disabled in Miser Mode', 'sizediffdisabled' ); } $msg = wfMsgForContent( 'Contributions' ); $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']'; $feedUrl = SpecialPage::getTitleFor( 'Contributions', $params['user'] )->getFullURL(); $target = $params['user'] == 'newbies' ? 'newbies' : Title::makeTitleSafe( NS_USER, $params['user'] )->getText(); $feed = new $wgFeedClasses[$params['feedformat']] ( $feedTitle, htmlspecialchars( $msg ), $feedUrl ); $pager = new ContribsPager( array( 'target' => $target, 'namespace' => $params['namespace'], 'year' => $params['year'], 'month' => $params['month'], 'tagFilter' => $params['tagfilter'], 'deletedOnly' => $params['deletedonly'], 'topOnly' => $params['toponly'], 'showSizeDiff' => $params['showsizediff'], ) ); $feedItems = array(); if( $pager->getNumRows() > 0 ) { foreach ( $pager->mResult as $row ) { $feedItems[] = $this->feedItem( $row ); } } ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems ); } protected function feedItem( $row ) { $title = Title::MakeTitle( intval( $row->page_namespace ), $row->page_title ); if( $title ) { $date = $row->rev_timestamp; $comments = $title->getTalkPage()->getFullURL(); $revision = Revision::newFromRow( $row); return new FeedItem( $title->getPrefixedText(), $this->feedItemDesc( $revision ), $title->getFullURL(), $date, $this->feedItemAuthor( $revision ), $comments ); } else { return null; } } /** * @param $revision Revision * @return string */ protected function feedItemAuthor( $revision ) { return $revision->getUserText(); } /** * @param $revision Revision * @return string */ protected function feedItemDesc( $revision ) { if( $revision ) { return '
' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) . htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . "
\n