20use MediaWiki\Pager\ContribsPager;
55 parent::__construct( $main, $action );
78 '@phan-var array<string,class-string<ChannelFeed>> $feedClasses';
79 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
87 $msg = $this->
msg(
'Contributions' )->inContentLanguage()->escaped();
91 $target = $params[
'user'];
92 if ( ExternalUserNames::isExternal( $target ) ) {
99 $feed =
new $feedClasses[$params[
'feedformat']](
106 $params[
'start'] =
'';
108 $params = ContribsPager::processDateFilter( $params );
110 $targetUser = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
112 $pager =
new ContribsPager(
115 'namespace' => $params[
'namespace'],
116 'start' => $params[
'start'],
117 'end' => $params[
'end'],
118 'tagFilter' => $params[
'tagfilter'],
119 'deletedOnly' => $params[
'deletedonly'],
120 'topOnly' => $params[
'toponly'],
121 'newOnly' => $params[
'newonly'],
122 'hideMinor' => $params[
'hideminor'],
123 'showSizeDiff' => $params[
'showsizediff'],
126 $this->linkBatchFactory,
127 $this->hookContainer,
129 $this->revisionStore,
130 $this->namespaceInfo,
132 $this->commentFormatter
136 if ( $pager->getLimit() > $feedLimit ) {
137 $pager->setLimit( $feedLimit );
141 if ( $pager->getNumRows() > 0 ) {
143 $limit = $pager->getLimit();
144 foreach ( $pager->mResult as $row ) {
146 if ( ++$count > $limit ) {
150 if ( $item !==
null ) {
151 $feedItems[] = $item;
168 $hookResult = $this->hookRunner->onApiFeedContributions__feedItem(
171 if ( $feedItem instanceof
FeedItem ) {
174 } elseif ( !$hookResult ) {
181 if ( $this->
getAuthority()->authorizeRead(
'read', $title ) ) {
182 $date = $row->rev_timestamp;
183 $comments = $title->getTalkPage()->getFullURL();
184 $revision = $this->revisionStore->newRevisionFromRow( $row, 0, $title );
187 $title->getPrefixedText(),
188 $this->feedItemDesc( $revision ),
189 $title->getFullURL( [
'diff' => $revision->getId() ] ),
191 $this->feedItemAuthor( $revision ),
206 return $user ? $user->getName() :
'';
215 $msg = $this->msg(
'colon-separator' )->inContentLanguage()->escaped();
217 $content = $revision->
getContent( SlotRecord::MAIN );
224 $html = nl2br( htmlspecialchars( $content->getText(), ENT_COMPAT ) );
235 return '<p>' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg .
236 htmlspecialchars( FeedItem::stripComment( $comment->text ??
'' ) ) .
237 "</p>\n<hr />\n<div>" . $html .
'</div>';
246 ParamValidator::PARAM_DEFAULT =>
'rss',
247 ParamValidator::PARAM_TYPE => $feedFormatNames
250 ParamValidator::PARAM_TYPE =>
'user',
251 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'temp',
'cidr',
'id',
'interwiki' ],
252 ParamValidator::PARAM_REQUIRED =>
true,
255 ParamValidator::PARAM_TYPE =>
'namespace'
258 ParamValidator::PARAM_TYPE =>
'integer'
261 ParamValidator::PARAM_TYPE =>
'integer'
264 ParamValidator::PARAM_ISMULTI =>
true,
266 ->getChangeTagsStore()->listDefinedTags()
268 ParamValidator::PARAM_DEFAULT =>
'',
270 'deletedonly' =>
false,
273 'hideminor' =>
false,
275 ParamValidator::PARAM_DEFAULT =>
false,
289 'action=feedcontributions&user=Example'
290 =>
'apihelp-feedcontributions-example-simple',
296 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Feedcontributions';
301class_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()
Factory for LinkBatch objects to batch query page metadata.
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,...