56 parent::__construct( $mainModule, $moduleName );
57 $this->specialPageFactory = $specialPageFactory;
58 $this->tempUserConfig = $tempUserConfig;
79 if ( !$config->get( MainConfigNames::Feed ) ) {
83 $feedClasses = $config->get( MainConfigNames::FeedClasses );
84 if ( !isset( $feedClasses[$this->params[
'feedformat']] ) ) {
88 $this->
getMain()->setCacheMode(
'public' );
91 $this->
getMain()->setCacheMaxAge( 15 );
94 $feedFormat = $this->params[
'feedformat'];
95 $specialPageName = $this->params[
'target'] !==
null
96 ?
'Recentchangeslinked'
99 $formatter = $this->getFeedObject( $feedFormat, $specialPageName );
102 $context =
new DerivativeContext( $this );
110 $rc = $this->specialPageFactory->getPage( $specialPageName );
111 if ( $rc ===
null ) {
112 throw new RuntimeException( __METHOD__ .
' not able to instance special page ' . $specialPageName );
114 '@phan-var \MediaWiki\SpecialPage\ChangesListSpecialPage $rc';
115 $rc->setContext( $context );
116 $rows = $rc->getRows();
131 private function getFeedObject( $feedFormat, $specialPageName ) {
132 if ( $specialPageName ===
'Recentchangeslinked' ) {
133 $title = Title::newFromText( $this->params[
'target'] );
134 if ( !$title || $title->isExternal() ) {
139 $feedObj = $feed->getFeedObject(
140 $this->
msg(
'recentchangeslinked-title', $title->getPrefixedText() )
141 ->inContentLanguage()->text(),
142 $this->msg(
'recentchangeslinked-feed' )->inContentLanguage()->text(),
143 SpecialPage::getTitleFor(
'Recentchangeslinked' )->getFullURL()
147 $feedObj = $feed->getFeedObject(
148 $this->
msg(
'recentchanges' )->inContentLanguage()->text(),
149 $this->
msg(
'recentchanges-feed-description' )->inContentLanguage()->text(),
150 SpecialPage::getTitleFor(
'Recentchanges' )->getFullURL()
159 $feedFormatNames = array_keys( $config->get( MainConfigNames::FeedClasses ) );
163 ParamValidator::PARAM_DEFAULT =>
'rss',
164 ParamValidator::PARAM_TYPE => $feedFormatNames,
168 ParamValidator::PARAM_TYPE =>
'namespace',
172 'associated' =>
false,
175 ParamValidator::PARAM_DEFAULT => 7,
176 IntegerDef::PARAM_MIN => 1,
177 ParamValidator::PARAM_TYPE =>
'integer',
180 ParamValidator::PARAM_DEFAULT => 50,
181 IntegerDef::PARAM_MIN => 1,
182 IntegerDef::PARAM_MAX => $config->get( MainConfigNames::FeedLimit ),
183 ParamValidator::PARAM_TYPE =>
'integer',
186 ParamValidator::PARAM_TYPE =>
'timestamp',
189 'hideminor' =>
false,
192 ParamValidator::PARAM_DEFAULT =>
false,
194 'apihelp-feedrecentchanges-param-hideanons-temp' :
195 'apihelp-feedrecentchanges-param-hideanons',
198 'hidepatrolled' =>
false,
199 'hidemyself' =>
false,
200 'hidecategorization' =>
false,
203 ParamValidator::PARAM_TYPE =>
'string',
205 'inverttags' =>
false,
208 ParamValidator::PARAM_TYPE =>
'string',
210 'showlinkedto' =>
false,
216 'action=feedrecentchanges'
217 =>
'apihelp-feedrecentchanges-example-simple',
218 'action=feedrecentchanges&days=30'
219 =>
'apihelp-feedrecentchanges-example-30days',
224 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Feedrecentchanges';
wfEscapeWikiText( $input)
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.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
getMain()
Get the main module.
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.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
getExamplesMessages()
Returns usage examples for this module.
execute()
Format the rows (generated by SpecialRecentchanges or SpecialRecentchangeslinked) as an RSS/Atom feed...
getCustomPrinter()
This module uses a custom feed wrapper printer.
__construct(ApiMain $mainModule, string $moduleName, SpecialPageFactory $specialPageFactory, TempUserConfig $tempUserConfig)
This is the main API class, used for both external and internal processing.
Feed to Special:RecentChanges and Special:RecentChangesLinked.
static buildItems( $rows)
Generate the feed items given a row from the database.
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.
Factory for handling the special page list and generating SpecialPage objects.
Parent class for all special pages.