33use Wikimedia\ParamValidator\ParamValidator;
34use Wikimedia\Rdbms\IConnectionProvider;
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();
92 $target = $params[
'user'];
93 if ( ExternalUserNames::isExternal( $target ) ) {
100 $feed =
new $feedClasses[$params[
'feedformat']](
107 $params[
'start'] =
'';
111 $targetUser = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
116 'namespace' => $params[
'namespace'],
117 'start' => $params[
'start'],
118 'end' => $params[
'end'],
119 'tagFilter' => $params[
'tagfilter'],
120 'deletedOnly' => $params[
'deletedonly'],
121 'topOnly' => $params[
'toponly'],
122 'newOnly' => $params[
'newonly'],
123 'hideMinor' => $params[
'hideminor'],
124 'showSizeDiff' => $params[
'showsizediff'],
127 $this->linkBatchFactory,
128 $this->hookContainer,
130 $this->revisionStore,
131 $this->namespaceInfo,
133 $this->commentFormatter
137 if ( $pager->getLimit() > $feedLimit ) {
138 $pager->setLimit( $feedLimit );
142 if ( $pager->getNumRows() > 0 ) {
144 $limit = $pager->getLimit();
145 foreach ( $pager->mResult as $row ) {
147 if ( ++$count > $limit ) {
151 if ( $item !==
null ) {
152 $feedItems[] = $item;
169 $hookResult = $this->hookRunner->onApiFeedContributions__feedItem(
172 if ( $feedItem instanceof
FeedItem ) {
175 } elseif ( !$hookResult ) {
182 if ( $this->
getAuthority()->authorizeRead(
'read', $title ) ) {
183 $date = $row->rev_timestamp;
184 $comments = $title->getTalkPage()->getFullURL();
185 $revision = $this->revisionStore->newRevisionFromRow( $row, 0, $title );
188 $title->getPrefixedText(),
189 $this->feedItemDesc( $revision ),
190 $title->getFullURL( [
'diff' => $revision->getId() ] ),
192 $this->feedItemAuthor( $revision ),
207 return $user ? $user->getName() :
'';
216 $msg = $this->
msg(
'colon-separator' )->inContentLanguage()->escaped();
218 $content = $revision->
getContent( SlotRecord::MAIN );
225 $html = nl2br( htmlspecialchars( $content->getText(), ENT_COMPAT ) );
236 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
237 htmlspecialchars( FeedItem::stripComment( $comment->text ??
'' ) ) .
238 "</p>\n<hr />\n<div>" . $html .
'</div>';
247 ParamValidator::PARAM_DEFAULT =>
'rss',
248 ParamValidator::PARAM_TYPE => $feedFormatNames
251 ParamValidator::PARAM_TYPE =>
'user',
252 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'temp',
'cidr',
'id',
'interwiki' ],
253 ParamValidator::PARAM_REQUIRED =>
true,
256 ParamValidator::PARAM_TYPE =>
'namespace'
259 ParamValidator::PARAM_TYPE =>
'integer'
262 ParamValidator::PARAM_TYPE =>
'integer'
265 ParamValidator::PARAM_ISMULTI =>
true,
267 ->getChangeTagsStore()->listDefinedTags()
269 ParamValidator::PARAM_DEFAULT =>
'',
271 'deletedonly' =>
false,
274 'hideminor' =>
false,
276 ParamValidator::PARAM_DEFAULT =>
false,
290 'action=feedcontributions&user=Example'
291 =>
'apihelp-feedcontributions-example-simple',
297 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Feedcontributions';
302class_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().
makeTitle( $linkId)
Convert a link ID to a Title.to override Title
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,...