54 $feedClasses = $config->get(
'FeedClasses' );
58 if ( !$config->get(
'Feed' ) ) {
59 $this->
dieUsage(
'Syndication feeds are not available',
'feed-unavailable' );
62 if ( !isset( $feedClasses[
$params[
'feedformat']] ) ) {
63 $this->
dieUsage(
'Invalid subscription feed type',
'feed-invalid' );
67 $endTime =
wfTimestamp(
TS_MW, time() - intval( $params[
'hours'] * 60 * 60 ) );
73 'siprop' =>
'general',
74 'list' =>
'watchlist',
75 'wlprop' =>
'title|user|comment|timestamp|ids',
78 'wllimit' => min( 50, $this->
getConfig()->
get(
'FeedLimit' ) )
81 if ( $params[
'wlowner'] !== null ) {
82 $fauxReqArr[
'wlowner'] = $params[
'wlowner'];
84 if ( $params[
'wltoken'] !== null ) {
85 $fauxReqArr[
'wltoken'] = $params[
'wltoken'];
87 if ( $params[
'wlexcludeuser'] !== null ) {
88 $fauxReqArr[
'wlexcludeuser'] = $params[
'wlexcludeuser'];
90 if ( $params[
'wlshow'] !== null ) {
91 $fauxReqArr[
'wlshow'] = $params[
'wlshow'];
93 if ( $params[
'wltype'] !== null ) {
94 $fauxReqArr[
'wltype'] = $params[
'wltype'];
99 if ( $params[
'linktosections'] ) {
100 $this->linkToSections =
true;
104 if ( $params[
'allrev'] ) {
105 $fauxReqArr[
'wlallrev'] =
'';
112 $module =
new ApiMain( $fauxReq );
115 $data = $module->getResult()->getResultData( [
'query',
'watchlist' ] );
123 $feedItems[] = $feedItem;
127 $msg =
wfMessage(
'watchlist' )->inContentLanguage()->text();
129 $feedTitle = $this->
getConfig()->get(
'Sitename' ) .
' - ' . $msg .
130 ' [' . $this->
getConfig()->get(
'LanguageCode' ) .
']';
133 $feed =
new $feedClasses[$params[
'feedformat']] (
135 htmlspecialchars( $msg ),
142 $this->
getMain()->setCacheMaxAge( 0 );
145 $feedTitle = $this->
getConfig()->get(
'Sitename' ) .
' - Error - ' .
146 wfMessage(
'watchlist' )->inContentLanguage()->text() .
147 ' [' . $this->
getConfig()->get(
'LanguageCode' ) .
']';
150 $feedFormat = isset(
$params[
'feedformat'] ) ?
$params[
'feedformat'] :
'rss';
151 $msg =
wfMessage(
'watchlist' )->inContentLanguage()->escaped();
152 $feed =
new $feedClasses[$feedFormat] ( $feedTitle, $msg, $feedUrl );
155 $errorCode = $e->getCodeString();
158 $errorCode =
'internal_api_error';
161 $errorText = $e->getMessage();
162 $feedItems[] =
new FeedItem(
"Error ($errorCode)", $errorText,
'',
'',
'' );
172 if ( !isset( $info[
'title'] ) ) {
177 $titleStr = $info[
'title'];
183 if ( isset( $info[
'pageid'] ) ) {
185 $curidParam = [
'curid' => $info[
'pageid'] ];
191 if ( isset( $info[
'revid'] ) ) {
192 $titleUrl =
$title->getFullURL( [
'diff' => $info[
'revid'] ] );
194 $titleUrl =
$title->getFullURL( $curidParam );
196 $comment = isset( $info[
'comment'] ) ? $info[
'comment'] : null;
202 if ( $this->linkToSections &&
$comment !== null &&
207 $sectionTitle = $wgParser->stripSectionName(
$matches[2] );
214 if ( isset( $info[
'user'] ) ) {
215 $user = $info[
'user'];
216 $completeText =
"$comment ($user)";
226 if ( $this->watchlistModule === null ) {
227 $this->watchlistModule = $this->
getMain()->getModuleManager()->getModule(
'query' )
228 ->getModuleManager()->getModule(
'watchlist' );
235 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
247 'linktosections' =>
false,
251 'allrev' =>
'allrev',
252 'owner' =>
'wlowner',
253 'token' =>
'wltoken',
256 'excludeuser' =>
'wlexcludeuser',
260 foreach ( $copyParams
as $from => $to ) {
261 $p = $wlparams[
$from];
262 if ( !is_array( $p ) ) {
271 foreach ( $p[ApiBase::PARAM_TYPE]
as $v ) {
272 if ( !isset( $p[ApiBase::PARAM_HELP_MSG_PER_VALUE][$v] ) ) {
280 foreach ( $copyParams
as $from => $to ) {
290 'action=feedwatchlist'
291 =>
'apihelp-feedwatchlist-example-default',
292 'action=feedwatchlist&allrev=&hours=6'
293 =>
'apihelp-feedwatchlist-example-all6hrs',
298 return 'https://www.mediawiki.org/wiki/API:Watchlist_feed';
static newFromID($id, $flags=0)
Create a new Title from an article ID.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
the array() calling protocol came about after MediaWiki 1.4rc1.
getResult()
Get the result object.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
getAllowedParams($flags=0)
execute()
Make a nested call to the API to request watchlist items in the last $hours.
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
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
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getMain()
Get the main module.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
it s the revision text itself In either if gzip is the revision text is gzipped $flags
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
when a variable name is used in a it is silently declared as a new local masking the global
getCustomPrinter()
This module uses a custom feed wrapper printer.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static normalizeSectionNameWhitespace($section)
Normalizes whitespace in a section name, such as might be returned by Parser::stripSectionName(), for use in the id's that are used for section links.
getConfig()
Get the Config object.
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 after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation 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 unsetoffset-wrap String Wrap the message in html(usually something like"<
This is the main API class, used for both external and internal processing.
namespace and then decline to actually register it file or subcat img or subcat $title
A base class for basic support for outputting syndication feeds in RSS and other formats.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
This action allows users to get their watchlist items in RSS/Atom formats.
dieUsage($description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
This abstract class implements many basic API functions, and is the base of all API classes...
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
This exception will be thrown when dieUsage is called to stop module execution.
static isMetadataKey($key)
Test whether a key should be considered metadata.