37 private $specialPageFactory;
49 parent::__construct( $mainModule, $moduleName );
50 $this->specialPageFactory = $specialPageFactory;
71 if ( !$config->get( MainConfigNames::Feed ) ) {
75 $feedClasses = $config->get( MainConfigNames::FeedClasses );
76 if ( !isset( $feedClasses[$this->params[
'feedformat']] ) ) {
80 $this->
getMain()->setCacheMode(
'public' );
83 $this->
getMain()->setCacheMaxAge( 15 );
86 $feedFormat = $this->params[
'feedformat'];
87 $specialPageName = $this->params[
'target'] !==
null
88 ?
'Recentchangeslinked'
91 $formatter = $this->getFeedObject( $feedFormat, $specialPageName );
102 $rc = $this->specialPageFactory->getPage( $specialPageName );
103 if ( $rc ===
null ) {
104 throw new RuntimeException( __METHOD__ .
' not able to instance special page ' . $specialPageName );
106 '@phan-var ChangesListSpecialPage $rc';
107 $rc->setContext( $context );
108 $rows = $rc->getRows();
123 private function getFeedObject( $feedFormat, $specialPageName ) {
124 if ( $specialPageName ===
'Recentchangeslinked' ) {
125 $title = Title::newFromText( $this->params[
'target'] );
131 $feedObj = $feed->getFeedObject(
132 $this->
msg(
'recentchangeslinked-title',
$title->getPrefixedText() )
133 ->inContentLanguage()->text(),
134 $this->msg(
'recentchangeslinked-feed' )->inContentLanguage()->text(),
139 $feedObj = $feed->getFeedObject(
140 $this->
msg(
'recentchanges' )->inContentLanguage()->text(),
141 $this->
msg(
'recentchanges-feed-description' )->inContentLanguage()->text(),
151 $feedFormatNames = array_keys( $config->get( MainConfigNames::FeedClasses ) );
155 ParamValidator::PARAM_DEFAULT =>
'rss',
156 ParamValidator::PARAM_TYPE => $feedFormatNames,
160 ParamValidator::PARAM_TYPE =>
'namespace',
163 'associated' =>
false,
166 ParamValidator::PARAM_DEFAULT => 7,
167 IntegerDef::PARAM_MIN => 1,
168 ParamValidator::PARAM_TYPE =>
'integer',
171 ParamValidator::PARAM_DEFAULT => 50,
172 IntegerDef::PARAM_MIN => 1,
173 IntegerDef::PARAM_MAX => $config->get( MainConfigNames::FeedLimit ),
174 ParamValidator::PARAM_TYPE =>
'integer',
177 ParamValidator::PARAM_TYPE =>
'timestamp',
180 'hideminor' =>
false,
182 'hideanons' =>
false,
184 'hidepatrolled' =>
false,
185 'hidemyself' =>
false,
186 'hidecategorization' =>
false,
189 ParamValidator::PARAM_TYPE =>
'string',
193 ParamValidator::PARAM_TYPE =>
'string',
195 'showlinkedto' =>
false,
201 'action=feedrecentchanges'
202 =>
'apihelp-feedrecentchanges-example-simple',
203 'action=feedrecentchanges&days=30'
204 =>
'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 ...
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
A class containing constants representing the names of configuration variables.
Factory for handling the special page list and generating SpecialPage objects.
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,...