51 $this->revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
52 $this->titleParser = MediaWikiServices::getInstance()->getTitleParser();
57 if ( !$config->get(
'Feed' ) ) {
61 $feedClasses = $config->get(
'FeedClasses' );
62 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
66 if ( $params[
'showsizediff'] && $this->
getConfig()->
get(
'MiserMode' ) ) {
70 $msg =
wfMessage(
'Contributions' )->inContentLanguage()->text();
71 $feedTitle = $config->get(
'Sitename' ) .
' - ' . $msg .
72 ' [' . $config->get(
'LanguageCode' ) .
']';
74 $target = $params[
'user'];
75 if ( ExternalUserNames::isExternal( $target ) ) {
82 $feed =
new $feedClasses[$params[
'feedformat']] (
84 htmlspecialchars( $msg ),
89 $params[
'start'] =
'';
91 $params = ContribsPager::processDateFilter( $params );
95 'namespace' => $params[
'namespace'],
96 'start' => $params[
'start'],
97 'end' => $params[
'end'],
98 'tagFilter' => $params[
'tagfilter'],
99 'deletedOnly' => $params[
'deletedonly'],
100 'topOnly' => $params[
'toponly'],
101 'newOnly' => $params[
'newonly'],
102 'hideMinor' => $params[
'hideminor'],
103 'showSizeDiff' => $params[
'showsizediff'],
106 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
107 if ( $pager->getLimit() > $feedLimit ) {
108 $pager->setLimit( $feedLimit );
112 if ( $pager->getNumRows() > 0 ) {
114 $limit = $pager->getLimit();
115 foreach ( $pager->mResult as $row ) {
117 if ( ++$count > $limit ) {
121 if ( $item !==
null ) {
122 $feedItems[] = $item;
135 $hookResult = $this->
getHookRunner()->onApiFeedContributions__feedItem(
138 if ( $feedItem instanceof
FeedItem ) {
141 } elseif ( !$hookResult ) {
146 $title = Title::makeTitle( (
int)$row->page_namespace, $row->page_title );
150 $date = $row->rev_timestamp;
151 $comments =
$title->getTalkPage()->getFullURL();
152 $revision = $this->revisionStore->newRevisionFromRow( $row, 0,
$title );
155 $title->getPrefixedText(),
156 $this->feedItemDesc( $revision ),
157 $title->getFullURL( [
'diff' => $revision->getId() ] ),
159 $this->feedItemAuthor( $revision ),
174 return $user ? $user->getName() :
'';
183 $msg =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
192 $html = nl2br( htmlspecialchars(
$content->getText() ) );
203 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
204 htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text :
'' ) ) .
205 "</p>\n<hr />\n<div>" . $html .
'</div>';
209 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
218 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'cidr',
'id',
'interwiki' ],
235 'deletedonly' =>
false,
238 'hideminor' =>
false,
244 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
253 'action=feedcontributions&user=Example'
254 =>
'apihelp-feedcontributions-example-simple',
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This abstract class implements many basic API functions, and is the base of all API classes.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
getMain()
Get the main module.
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
getHookRunner()
Get an ApiHookRunner for running core API hooks.
feedItemDesc(RevisionRecord $revision)
feedItemAuthor(RevisionRecord $revision)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getCustomPrinter()
This module uses a custom feed wrapper printer.
RevisionStore $revisionStore
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getExamplesMessages()
Returns usage examples for this module.
getUser()
Stable to override.
getContext()
Get the base IContextSource object.
A base class for outputting syndication feeds (e.g.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Content object implementation for representing flat text.
A title parser service for MediaWiki.