47 $this->revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
52 if ( !$config->get(
'Feed' ) ) {
56 $feedClasses = $config->get(
'FeedClasses' );
57 if ( !isset( $feedClasses[
$params[
'feedformat']] ) ) {
61 if ( $params[
'showsizediff'] && $this->
getConfig()->
get(
'MiserMode' ) ) {
65 $msg =
wfMessage(
'Contributions' )->inContentLanguage()->text();
66 $feedTitle = $config->get(
'Sitename' ) .
' - ' . $msg .
67 ' [' . $config->get(
'LanguageCode' ) .
']';
68 $feedUrl = SpecialPage::getTitleFor(
'Contributions',
$params[
'user'] )->getFullURL();
70 $target =
$params[
'user'] ==
'newbies'
72 : Title::makeTitleSafe( NS_USER,
$params[
'user'] )->getText();
74 $feed =
new $feedClasses[
$params[
'feedformat']] (
76 htmlspecialchars( $msg ),
87 'namespace' =>
$params[
'namespace'],
90 'tagFilter' =>
$params[
'tagfilter'],
91 'deletedOnly' =>
$params[
'deletedonly'],
92 'topOnly' =>
$params[
'toponly'],
93 'newOnly' =>
$params[
'newonly'],
94 'hideMinor' =>
$params[
'hideminor'],
95 'showSizeDiff' =>
$params[
'showsizediff'],
98 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
99 if ( $pager->getLimit() > $feedLimit ) {
100 $pager->setLimit( $feedLimit );
104 if ( $pager->getNumRows() > 0 ) {
106 $limit = $pager->getLimit();
107 foreach ( $pager->mResult as $row ) {
109 if ( ++$count > $limit ) {
113 if ( $item !==
null ) {
114 $feedItems[] = $item;
127 $hookResult = Hooks::run(
128 'ApiFeedContributions::feedItem',
132 if ( $feedItem instanceof
FeedItem ) {
135 } elseif ( !$hookResult ) {
140 $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
141 if ( $title && $title->userCan(
'read', $this->getUser() ) ) {
142 $date = $row->rev_timestamp;
143 $comments = $title->getTalkPage()->getFullURL();
144 $revision = $this->revisionStore->newRevisionFromRow( $row );
147 $title->getPrefixedText(),
148 $this->feedItemDesc( $revision ),
149 $title->getFullURL( [
'diff' => $revision->getId() ] ),
151 $this->feedItemAuthor( $revision ),
166 return $user ? $user->getName() :
'';
176 $msg =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
185 $html = nl2br( htmlspecialchars(
$content->getNativeData() ) );
196 return '<p>' . htmlspecialchars( $this->
feedItemAuthor( $revision ) ) . $msg .
198 "</p>\n<hr />\n<div>" .
$html .
'</div>';
205 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
230 'deletedonly' =>
false,
233 'hideminor' =>
false,
239 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
248 'action=feedcontributions&user=Example'
249 =>
'apihelp-feedcontributions-example-simple',
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
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.
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 basic support for outputting syndication feeds in RSS and other formats.
static stripComment( $text)
Quickie hack... strip out wikilinks to more legible form from the comment.
Content object implementation for representing flat text.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
returning false will NOT prevent logging $e