50 $this->revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
51 $this->titleParser = MediaWikiServices::getInstance()->getTitleParser();
56 if ( !$config->get(
'Feed' ) ) {
60 $feedClasses = $config->get(
'FeedClasses' );
61 if ( !isset( $feedClasses[$params[
'feedformat']] ) ) {
65 if ( $params[
'showsizediff'] && $this->
getConfig()->
get(
'MiserMode' ) ) {
69 $msg =
wfMessage(
'Contributions' )->inContentLanguage()->text();
70 $feedTitle = $config->get(
'Sitename' ) .
' - ' . $msg .
71 ' [' . $config->get(
'LanguageCode' ) .
']';
72 $feedUrl = SpecialPage::getTitleFor(
'Contributions', $params[
'user'] )->getFullURL();
75 $target = $this->titleParser
76 ->parseTitle( $params[
'user'],
NS_USER )
85 $feed =
new $feedClasses[$params[
'feedformat']] (
87 htmlspecialchars( $msg ),
92 $params[
'start'] =
'';
98 'namespace' => $params[
'namespace'],
99 'start' => $params[
'start'],
100 'end' => $params[
'end'],
101 'tagFilter' => $params[
'tagfilter'],
102 'deletedOnly' => $params[
'deletedonly'],
103 'topOnly' => $params[
'toponly'],
104 'newOnly' => $params[
'newonly'],
105 'hideMinor' => $params[
'hideminor'],
106 'showSizeDiff' => $params[
'showsizediff'],
109 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
110 if ( $pager->getLimit() > $feedLimit ) {
111 $pager->setLimit( $feedLimit );
115 if ( $pager->getNumRows() > 0 ) {
117 $limit = $pager->getLimit();
118 foreach ( $pager->mResult as $row ) {
120 if ( ++$count > $limit ) {
124 if ( $item !==
null ) {
125 $feedItems[] = $item;
138 $hookResult = Hooks::run(
139 'ApiFeedContributions::feedItem',
143 if ( $feedItem instanceof
FeedItem ) {
146 } elseif ( !$hookResult ) {
151 $title = Title::makeTitle( (
int)$row->page_namespace, $row->page_title );
155 $date = $row->rev_timestamp;
156 $comments =
$title->getTalkPage()->getFullURL();
157 $revision = $this->revisionStore->newRevisionFromRow( $row );
160 $title->getPrefixedText(),
161 $this->feedItemDesc( $revision ),
162 $title->getFullURL( [
'diff' => $revision->getId() ] ),
164 $this->feedItemAuthor( $revision ),
179 return $user ? $user->getName() :
'';
188 $msg =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
197 $html = nl2br( htmlspecialchars(
$content->getText() ) );
208 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
210 "</p>\n<hr />\n<div>" . $html .
'</div>';
214 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
239 'deletedonly' =>
false,
242 'hideminor' =>
false,
248 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
257 'action=feedcontributions&user=Example'
258 =>
'apihelp-feedcontributions-example-simple',
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
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.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
feedItemDesc(RevisionRecord $revision)
feedItemAuthor(RevisionRecord $revision)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getCustomPrinter()
This module uses a custom feed wrapper printer.
RevisionStore $revisionStore
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getExamplesMessages()
Returns usage examples for this module.
getContext()
Get the base IContextSource object.
A base class for outputting syndication feeds (e.g.
static stripComment( $text)
Quickie hack... strip out wikilinks to more legible form from the comment.
Content object implementation for representing flat text.
A title parser service for MediaWiki.