11use MediaWiki\Cache\LinkBatchFactory;
20use MediaWiki\Pager\ContribsPager;
43 private LinkBatchFactory $linkBatchFactory;
56 LinkBatchFactory $linkBatchFactory,
63 parent::__construct( $main, $action );
64 $this->revisionStore = $revisionStore;
65 $this->linkRenderer = $linkRenderer;
66 $this->linkBatchFactory = $linkBatchFactory;
67 $this->hookContainer = $hookContainer;
68 $this->dbProvider = $dbProvider;
69 $this->namespaceInfo = $namespaceInfo;
70 $this->userFactory = $userFactory;
71 $this->commentFormatter = $commentFormatter;
94 '@phan-var array<string,class-string<ChannelFeed>> $feedClasses';
95 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
103 $msg = $this->
msg(
'Contributions' )->inContentLanguage()->escaped();
107 $target = $params[
'user'];
108 if ( ExternalUserNames::isExternal( $target ) ) {
115 $feed =
new $feedClasses[$params[
'feedformat']](
122 $params[
'start'] =
'';
124 $params = ContribsPager::processDateFilter( $params );
126 $targetUser = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
128 $pager =
new ContribsPager(
131 'namespace' => $params[
'namespace'],
132 'start' => $params[
'start'],
133 'end' => $params[
'end'],
134 'tagFilter' => $params[
'tagfilter'],
135 'deletedOnly' => $params[
'deletedonly'],
136 'topOnly' => $params[
'toponly'],
137 'newOnly' => $params[
'newonly'],
138 'hideMinor' => $params[
'hideminor'],
139 'showSizeDiff' => $params[
'showsizediff'],
142 $this->linkBatchFactory,
143 $this->hookContainer,
145 $this->revisionStore,
146 $this->namespaceInfo,
148 $this->commentFormatter
152 if ( $pager->getLimit() > $feedLimit ) {
153 $pager->setLimit( $feedLimit );
157 if ( $pager->getNumRows() > 0 ) {
159 $limit = $pager->getLimit();
160 foreach ( $pager->mResult as $row ) {
162 if ( ++$count > $limit ) {
166 if ( $item !==
null ) {
167 $feedItems[] = $item;
184 $hookResult = $this->hookRunner->onApiFeedContributions__feedItem(
187 if ( $feedItem instanceof
FeedItem ) {
190 } elseif ( !$hookResult ) {
197 if ( $this->
getAuthority()->authorizeRead(
'read', $title ) ) {
198 $date = $row->rev_timestamp;
199 $comments = $title->getTalkPage()->getFullURL();
200 $revision = $this->revisionStore->newRevisionFromRow( $row, 0, $title );
203 $title->getPrefixedText(),
204 $this->feedItemDesc( $revision ),
205 $title->getFullURL( [
'diff' => $revision->getId() ] ),
207 $this->feedItemAuthor( $revision ),
222 return $user ? $user->getName() :
'';
231 $msg = $this->msg(
'colon-separator' )->inContentLanguage()->escaped();
233 $content = $revision->
getContent( SlotRecord::MAIN );
240 $html = nl2br( htmlspecialchars( $content->getText(), ENT_COMPAT ) );
251 return '<p>' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg .
252 htmlspecialchars( FeedItem::stripComment( $comment->text ??
'' ) ) .
253 "</p>\n<hr />\n<div>" . $html .
'</div>';
262 ParamValidator::PARAM_DEFAULT =>
'rss',
263 ParamValidator::PARAM_TYPE => $feedFormatNames
266 ParamValidator::PARAM_TYPE =>
'user',
267 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'temp',
'cidr',
'id',
'interwiki' ],
268 ParamValidator::PARAM_REQUIRED =>
true,
271 ParamValidator::PARAM_TYPE =>
'namespace'
274 ParamValidator::PARAM_TYPE =>
'integer'
277 ParamValidator::PARAM_TYPE =>
'integer'
280 ParamValidator::PARAM_ISMULTI =>
true,
282 ->getChangeTagsStore()->listDefinedTags()
284 ParamValidator::PARAM_DEFAULT =>
'',
286 'deletedonly' =>
false,
289 'hideminor' =>
false,
291 ParamValidator::PARAM_DEFAULT =>
false,
305 'action=feedcontributions&user=Example'
306 =>
'apihelp-feedcontributions-example-simple',
312 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Feedcontributions';
317class_alias( ApiFeedContributions::class,
'ApiFeedContributions' );
This is the main API class, used for both external and internal processing.
Content object implementation for representing flat text.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
A class containing constants representing the names of configuration variables.
const FeedClasses
Name constant for the FeedClasses setting, for use with Config::get()
const Feed
Name constant for the Feed setting, for use with Config::get()
const Sitename
Name constant for the Sitename setting, for use with Config::get()
const LanguageCode
Name constant for the LanguageCode setting, for use with Config::get()
const MiserMode
Name constant for the MiserMode setting, for use with Config::get()
const FeedLimit
Name constant for the FeedLimit setting, for use with Config::get()
Parent class for all special pages.
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,...