96 parent::__construct( $main, $action );
123 if ( !$config->get(
'Feed' ) ) {
127 $feedClasses = $config->get(
'FeedClasses' );
128 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
132 if ( $params[
'showsizediff'] && $this->
getConfig()->
get(
'MiserMode' ) ) {
136 $msg =
wfMessage(
'Contributions' )->inContentLanguage()->text();
137 $feedTitle = $config->get(
'Sitename' ) .
' - ' . $msg .
138 ' [' . $config->get(
'LanguageCode' ) .
']';
140 $target = $params[
'user'];
141 if ( ExternalUserNames::isExternal( $target ) ) {
148 $feed =
new $feedClasses[$params[
'feedformat']] (
150 htmlspecialchars( $msg ),
155 $params[
'start'] =
'';
157 $params = ContribsPager::processDateFilter( $params );
159 $targetUser = $this->userFactory->newFromName( $target, UserFactory::RIGOR_NONE );
164 'namespace' => $params[
'namespace'],
165 'start' => $params[
'start'],
166 'end' => $params[
'end'],
167 'tagFilter' => $params[
'tagfilter'],
168 'deletedOnly' => $params[
'deletedonly'],
169 'topOnly' => $params[
'toponly'],
170 'newOnly' => $params[
'newonly'],
171 'hideMinor' => $params[
'hideminor'],
172 'showSizeDiff' => $params[
'showsizediff'],
175 $this->linkBatchFactory,
176 $this->hookContainer,
178 $this->actorMigration,
179 $this->revisionStore,
180 $this->namespaceInfo,
184 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
185 if ( $pager->getLimit() > $feedLimit ) {
186 $pager->setLimit( $feedLimit );
190 if ( $pager->getNumRows() > 0 ) {
192 $limit = $pager->getLimit();
193 foreach ( $pager->mResult as $row ) {
195 if ( ++$count > $limit ) {
199 if ( $item !==
null ) {
200 $feedItems[] = $item;
213 $hookResult = $this->hookRunner->onApiFeedContributions__feedItem(
216 if ( $feedItem instanceof
FeedItem ) {
219 } elseif ( !$hookResult ) {
224 $title = Title::makeTitle( (
int)$row->page_namespace, $row->page_title );
227 $date = $row->rev_timestamp;
228 $comments =
$title->getTalkPage()->getFullURL();
229 $revision = $this->revisionStore->newRevisionFromRow( $row, 0,
$title );
232 $title->getPrefixedText(),
233 $this->feedItemDesc( $revision ),
234 $title->getFullURL( [
'diff' => $revision->getId() ] ),
236 $this->feedItemAuthor( $revision ),
251 return $user ? $user->getName() :
'';
260 $msg =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
269 $html = nl2br( htmlspecialchars(
$content->getText() ) );
280 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
281 htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text :
'' ) ) .
282 "</p>\n<hr />\n<div>" . $html .
'</div>';
286 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
295 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'cidr',
'id',
'interwiki' ],
312 'deletedonly' =>
false,
315 'hideminor' =>
false,
321 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
330 'action=feedcontributions&user=Example'
331 =>
'apihelp-feedcontributions-example-simple',
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
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.
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.
ILoadBalancer $loadBalancer
ActorMigration $actorMigration
feedItemDesc(RevisionRecord $revision)
feedItemAuthor(RevisionRecord $revision)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
NamespaceInfo $namespaceInfo
getCustomPrinter()
This module uses a custom feed wrapper printer.
__construct(ApiMain $main, $action, RevisionStore $revisionStore, TitleParser $titleParser, LinkRenderer $linkRenderer, LinkBatchFactory $linkBatchFactory, HookContainer $hookContainer, ILoadBalancer $loadBalancer, NamespaceInfo $namespaceInfo, ActorMigration $actorMigration, UserFactory $userFactory)
LinkBatchFactory $linkBatchFactory
HookContainer $hookContainer
RevisionStore $revisionStore
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
ApiHookRunner $hookRunner
getExamplesMessages()
Returns usage examples for this module.
LinkRenderer $linkRenderer
This is the main API class, used for both external and internal processing.
getContext()
Get the base IContextSource object.
A base class for outputting syndication feeds (e.g.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
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.