Go to the documentation of this file.
51 $services = MediaWikiServices::getInstance();
52 $this->revisionStore = $services->getRevisionStore();
53 $this->titleParser = $services->getTitleParser();
58 if ( !$config->get(
'Feed' ) ) {
62 $feedClasses = $config->get(
'FeedClasses' );
63 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
67 if ( $params[
'showsizediff'] && $this->
getConfig()->
get(
'MiserMode' ) ) {
71 $msg =
wfMessage(
'Contributions' )->inContentLanguage()->text();
72 $feedTitle = $config->get(
'Sitename' ) .
' - ' . $msg .
73 ' [' . $config->get(
'LanguageCode' ) .
']';
75 $target = $params[
'user'];
83 $feed =
new $feedClasses[$params[
'feedformat']] (
85 htmlspecialchars( $msg ),
90 $params[
'start'] =
'';
97 'namespace' => $params[
'namespace'],
98 'start' => $params[
'start'],
99 'end' => $params[
'end'],
100 'tagFilter' => $params[
'tagfilter'],
101 'deletedOnly' => $params[
'deletedonly'],
102 'topOnly' => $params[
'toponly'],
103 'newOnly' => $params[
'newonly'],
104 'hideMinor' => $params[
'hideminor'],
105 'showSizeDiff' => $params[
'showsizediff'],
107 $services->getLinkRenderer(),
108 $services->getLinkBatchFactory(),
109 $services->getHookContainer(),
110 $services->getDBLoadBalancer(),
111 $services->getActorMigration(),
112 $this->revisionStore,
113 $services->getNamespaceInfo()
116 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
117 if ( $pager->getLimit() > $feedLimit ) {
118 $pager->setLimit( $feedLimit );
122 if ( $pager->getNumRows() > 0 ) {
124 $limit = $pager->getLimit();
125 foreach ( $pager->mResult as $row ) {
127 if ( ++$count > $limit ) {
131 if ( $item !==
null ) {
132 $feedItems[] = $item;
145 $hookResult = $this->
getHookRunner()->onApiFeedContributions__feedItem(
148 if ( $feedItem instanceof
FeedItem ) {
151 } elseif ( !$hookResult ) {
159 $date = $row->rev_timestamp;
160 $comments =
$title->getTalkPage()->getFullURL();
161 $revision = $this->revisionStore->newRevisionFromRow( $row, 0,
$title );
164 $title->getPrefixedText(),
165 $this->feedItemDesc( $revision ),
166 $title->getFullURL( [
'diff' => $revision->getId() ] ),
168 $this->feedItemAuthor( $revision ),
183 return $user ? $user->getName() :
'';
192 $msg =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
201 $html = nl2br( htmlspecialchars(
$content->getText() ) );
212 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
214 "</p>\n<hr />\n<div>" . $html .
'</div>';
218 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
227 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'cidr',
'id',
'interwiki' ],
244 'deletedonly' =>
false,
247 'hideminor' =>
false,
253 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
262 'action=feedcontributions&user=Example'
263 =>
'apihelp-feedcontributions-example-simple',
A base class for outputting syndication feeds (e.g.
getContext()
Get the base IContextSource object.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
getCustomPrinter()
This module uses a custom feed wrapper printer.
getResult()
Get the result object.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
static stripComment( $text)
Quickie hack...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
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,...
This abstract class implements many basic API functions, and is the base of all API classes.
feedItemAuthor(RevisionRecord $revision)
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
A title parser service for MediaWiki.
RevisionStore $revisionStore
Content object implementation for representing flat text.
feedItemDesc(RevisionRecord $revision)
getMain()
Get the main module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExamplesMessages()
Returns usage examples for this module.
getHookRunner()
Get an ApiHookRunner for running core API hooks.
static isExternal( $username)
Tells whether the username is external or not.