52 parent::__construct( $mainModule, $moduleName );
53 $this->specialPageFactory = $specialPageFactory;
74 if ( !$config->get( MainConfigNames::Feed ) ) {
78 $feedClasses = $config->get( MainConfigNames::FeedClasses );
79 if ( !isset( $feedClasses[$this->params[
'feedformat']] ) ) {
83 $this->
getMain()->setCacheMode(
'public' );
86 $this->
getMain()->setCacheMaxAge( 15 );
89 $feedFormat = $this->params[
'feedformat'];
90 $specialPageName = $this->params[
'target'] !==
null
91 ?
'Recentchangeslinked'
94 $formatter = $this->getFeedObject( $feedFormat, $specialPageName );
105 $rc = $this->specialPageFactory->getPage( $specialPageName );
106 if ( $rc ===
null ) {
107 throw new RuntimeException( __METHOD__ .
' not able to instance special page ' . $specialPageName );
109 '@phan-var \MediaWiki\SpecialPage\ChangesListSpecialPage $rc';
110 $rc->setContext( $context );
111 $rows = $rc->getRows();
126 private function getFeedObject( $feedFormat, $specialPageName ) {
127 if ( $specialPageName ===
'Recentchangeslinked' ) {
128 $title = Title::newFromText( $this->params[
'target'] );
129 if ( !$title || $title->isExternal() ) {
134 $feedObj = $feed->getFeedObject(
135 $this->
msg(
'recentchangeslinked-title', $title->getPrefixedText() )
136 ->inContentLanguage()->text(),
137 $this->msg(
'recentchangeslinked-feed' )->inContentLanguage()->text(),
138 SpecialPage::getTitleFor(
'Recentchangeslinked' )->getFullURL()
142 $feedObj = $feed->getFeedObject(
143 $this->
msg(
'recentchanges' )->inContentLanguage()->text(),
144 $this->
msg(
'recentchanges-feed-description' )->inContentLanguage()->text(),
145 SpecialPage::getTitleFor(
'Recentchanges' )->getFullURL()
154 $feedFormatNames = array_keys( $config->get( MainConfigNames::FeedClasses ) );
158 ParamValidator::PARAM_DEFAULT =>
'rss',
159 ParamValidator::PARAM_TYPE => $feedFormatNames,
163 ParamValidator::PARAM_TYPE =>
'namespace',
167 'associated' =>
false,
170 ParamValidator::PARAM_DEFAULT => 7,
171 IntegerDef::PARAM_MIN => 1,
172 ParamValidator::PARAM_TYPE =>
'integer',
175 ParamValidator::PARAM_DEFAULT => 50,
176 IntegerDef::PARAM_MIN => 1,
177 IntegerDef::PARAM_MAX => $config->get( MainConfigNames::FeedLimit ),
178 ParamValidator::PARAM_TYPE =>
'integer',
181 ParamValidator::PARAM_TYPE =>
'timestamp',
184 'hideminor' =>
false,
186 'hideanons' =>
false,
188 'hidepatrolled' =>
false,
189 'hidemyself' =>
false,
190 'hidecategorization' =>
false,
193 ParamValidator::PARAM_TYPE =>
'string',
195 'inverttags' =>
false,
198 ParamValidator::PARAM_TYPE =>
'string',
200 'showlinkedto' =>
false,
206 'action=feedrecentchanges'
207 =>
'apihelp-feedrecentchanges-example-simple',
208 'action=feedrecentchanges&days=30'
209 =>
'apihelp-feedrecentchanges-example-30days',
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.
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,...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
__construct(ApiMain $mainModule, string $moduleName, SpecialPageFactory $specialPageFactory)
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.
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()
An IContextSource implementation which will inherit context from another source but allow individual ...
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.