75 parent::__construct( $main, $action );
76 $this->revisionStore = $revisionStore;
77 $this->linkRenderer = $linkRenderer;
78 $this->linkBatchFactory = $linkBatchFactory;
79 $this->hookContainer = $hookContainer;
80 $this->dbProvider = $dbProvider;
81 $this->namespaceInfo = $namespaceInfo;
82 $this->userFactory = $userFactory;
83 $this->commentFormatter = $commentFormatter;
106 if ( !isset( $feedClasses[
$params[
'feedformat']] ) ) {
114 $msg = $this->
msg(
'Contributions' )->inContentLanguage()->text();
119 if ( ExternalUserNames::isExternal( $target ) ) {
126 $feed =
new $feedClasses[
$params[
'feedformat']] (
128 htmlspecialchars( $msg ),
137 $targetUser = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
142 'namespace' =>
$params[
'namespace'],
145 'tagFilter' =>
$params[
'tagfilter'],
146 'deletedOnly' =>
$params[
'deletedonly'],
147 'topOnly' =>
$params[
'toponly'],
148 'newOnly' =>
$params[
'newonly'],
149 'hideMinor' =>
$params[
'hideminor'],
150 'showSizeDiff' =>
$params[
'showsizediff'],
153 $this->linkBatchFactory,
154 $this->hookContainer,
156 $this->revisionStore,
157 $this->namespaceInfo,
159 $this->commentFormatter
163 if ( $pager->getLimit() > $feedLimit ) {
164 $pager->setLimit( $feedLimit );
168 if ( $pager->getNumRows() > 0 ) {
170 $limit = $pager->getLimit();
171 foreach ( $pager->mResult as $row ) {
173 if ( ++$count > $limit ) {
177 if ( $item !==
null ) {
178 $feedItems[] = $item;
191 $hookResult = $this->hookRunner->onApiFeedContributions__feedItem(
194 if ( $feedItem instanceof
FeedItem ) {
197 } elseif ( !$hookResult ) {
202 $title = Title::makeTitle( (
int)$row->page_namespace, $row->page_title );
204 if ( $title && $this->
getAuthority()->authorizeRead(
'read', $title ) ) {
205 $date = $row->rev_timestamp;
206 $comments = $title->getTalkPage()->getFullURL();
207 $revision = $this->revisionStore->newRevisionFromRow( $row, 0, $title );
210 $title->getPrefixedText(),
211 $this->feedItemDesc( $revision ),
212 $title->getFullURL( [
'diff' => $revision->getId() ] ),
214 $this->feedItemAuthor( $revision ),
229 return $user ? $user->getName() :
'';
238 $msg = $this->
msg(
'colon-separator' )->inContentLanguage()->text();
240 $content = $revision->
getContent( SlotRecord::MAIN );
247 $html = nl2br( htmlspecialchars( $content->getText(), ENT_COMPAT ) );
258 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
259 htmlspecialchars( FeedItem::stripComment( $comment->text ??
'' ) ) .
260 "</p>\n<hr />\n<div>" . $html .
'</div>';
268 ParamValidator::PARAM_DEFAULT =>
'rss',
269 ParamValidator::PARAM_TYPE => $feedFormatNames
272 ParamValidator::PARAM_TYPE =>
'user',
273 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip',
'temp',
'cidr',
'id',
'interwiki' ],
274 ParamValidator::PARAM_REQUIRED =>
true,
277 ParamValidator::PARAM_TYPE =>
'namespace'
280 ParamValidator::PARAM_TYPE =>
'integer'
283 ParamValidator::PARAM_TYPE =>
'integer'
286 ParamValidator::PARAM_ISMULTI =>
true,
288 ->getChangeTagsStore()->listDefinedTags()
290 ParamValidator::PARAM_DEFAULT =>
'',
292 'deletedonly' =>
false,
295 'hideminor' =>
false,
297 ParamValidator::PARAM_DEFAULT =>
false,
310 'action=feedcontributions&user=Example'
311 =>
'apihelp-feedcontributions-example-simple',
316 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Feedcontributions';
321class_alias( ApiFeedContributions::class,
'ApiFeedContributions' );
array $params
The job parameters.
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,...