Go to the documentation of this file.
54 $feedClasses = $config->get(
'FeedClasses' );
59 if ( !$config->get(
'Feed' ) ) {
63 if ( !isset( $feedClasses[
$params[
'feedformat']] ) ) {
74 'siprop' =>
'general',
75 'list' =>
'watchlist',
76 'wlprop' =>
'title|user|comment|timestamp|ids',
79 'wllimit' => min( 50, $this->
getConfig()->
get(
'FeedLimit' ) )
82 if ( $params[
'wlowner'] !==
null ) {
83 $fauxReqArr[
'wlowner'] =
$params[
'wlowner'];
85 if (
$params[
'wltoken'] !==
null ) {
86 $fauxReqArr[
'wltoken'] =
$params[
'wltoken'];
88 if (
$params[
'wlexcludeuser'] !==
null ) {
89 $fauxReqArr[
'wlexcludeuser'] =
$params[
'wlexcludeuser'];
91 if (
$params[
'wlshow'] !==
null ) {
92 $fauxReqArr[
'wlshow'] =
$params[
'wlshow'];
94 if (
$params[
'wltype'] !==
null ) {
95 $fauxReqArr[
'wltype'] =
$params[
'wltype'];
100 if (
$params[
'linktosections'] ) {
101 $this->linkToSections =
true;
106 $fauxReqArr[
'wlallrev'] =
'';
113 $module =
new ApiMain( $fauxReq );
116 $data = $module->getResult()->getResultData( [
'query',
'watchlist' ] );
118 foreach ( (
array)$data
as $key => $info ) {
124 $feedItems[] = $feedItem;
128 $msg =
wfMessage(
'watchlist' )->inContentLanguage()->text();
130 $feedTitle = $this->
getConfig()->get(
'Sitename' ) .
' - ' . $msg .
131 ' [' . $this->
getConfig()->get(
'LanguageCode' ) .
']';
134 $feed =
new $feedClasses[
$params[
'feedformat']] (
136 htmlspecialchars( $msg ),
141 }
catch ( Exception
$e ) {
143 $this->
getMain()->setCacheMaxAge( 0 );
146 $feedTitle = $this->
getConfig()->get(
'Sitename' ) .
' - Error - ' .
147 wfMessage(
'watchlist' )->inContentLanguage()->text() .
148 ' [' . $this->
getConfig()->get(
'LanguageCode' ) .
']';
151 $feedFormat = isset(
$params[
'feedformat'] ) ?
$params[
'feedformat'] :
'rss';
152 $msg =
wfMessage(
'watchlist' )->inContentLanguage()->escaped();
153 $feed =
new $feedClasses[$feedFormat] ( $feedTitle, $msg, $feedUrl );
156 foreach (
$e->getStatusValue()->getErrors()
as $error ) {
159 $errorTitle = $this->
msg(
'api-feed-error-title', $msg->getApiCode() );
160 $errorText = $msg->text();
161 $feedItems[] =
new FeedItem( $errorTitle, $errorText,
'',
'',
'' );
165 $errorCode =
$e->getCodeString();
168 $errorCode =
'internal_api_error';
170 $errorTitle = $this->
msg(
'api-feed-error-title', $errorCode );
171 $errorText =
$e->getMessage();
172 $feedItems[] =
new FeedItem( $errorTitle, $errorText,
'',
'',
'' );
184 if ( !isset( $info[
'title'] ) ) {
189 $titleStr = $info[
'title'];
195 if ( isset( $info[
'pageid'] ) ) {
197 $curidParam = [
'curid' => $info[
'pageid'] ];
203 if ( isset( $info[
'revid'] ) ) {
204 $titleUrl =
$title->getFullURL( [
'diff' => $info[
'revid'] ] );
206 $titleUrl =
$title->getFullURL( $curidParam );
208 $comment = isset( $info[
'comment'] ) ? $info[
'comment'] :
null;
214 if ( $this->linkToSections && $comment !==
null &&
215 preg_match(
'!(.*)/\*\s*(.*?)\s*\*/(.*)!', $comment,
$matches )
220 $sectionTitle = Sanitizer::normalizeSectionNameWhitespace( $sectionTitle );
224 $timestamp = $info[
'timestamp'];
226 if ( isset( $info[
'user'] ) ) {
227 $user = $info[
'user'];
228 $completeText =
"$comment ($user)";
231 $completeText = (
string)$comment;
234 return new FeedItem( $titleStr, $completeText, $titleUrl, $timestamp,
$user );
238 if ( $this->watchlistModule ===
null ) {
239 $this->watchlistModule = $this->
getMain()->getModuleManager()->getModule(
'query' )
240 ->getModuleManager()->getModule(
'watchlist' );
247 $feedFormatNames = array_keys( $this->
getConfig()->
get(
'FeedClasses' ) );
259 'linktosections' =>
false,
263 'allrev' =>
'allrev',
264 'owner' =>
'wlowner',
265 'token' =>
'wltoken',
268 'excludeuser' =>
'wlexcludeuser',
272 foreach ( $copyParams
as $from => $to ) {
273 $p = $wlparams[$from];
274 if ( !is_array( $p ) ) {
292 foreach ( $copyParams
as $from => $to ) {
302 'action=feedwatchlist'
303 =>
'apihelp-feedwatchlist-example-default',
304 'action=feedwatchlist&allrev=&hours=6'
305 =>
'apihelp-feedwatchlist-example-all6hrs',
310 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist_feed';
getExamplesMessages()
Returns usage examples for this module.
getAllowedParams( $flags=0)
This is the main API class, used for both external and internal processing.
getConfig()
Get the Config object.
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 account $user
WebRequest clone which takes values from a provided array.
This action allows users to get their watchlist items in RSS/Atom formats.
A base class for basic support for outputting syndication feeds in RSS and other formats.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Exception used to abort API execution with an error.
getCustomPrinter()
This module uses a custom feed wrapper printer.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
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,...
getHelpUrls()
Return links to more detailed help pages about the module.
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 abstract class implements many basic API functions, and is the base of all API classes.
getLanguage()
Get the Language object.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
namespace and then decline to actually register it file or subcat img or subcat $title
This exception will be thrown when dieUsage is called to stop module execution.
execute()
Make a nested call to the API to request watchlist items in the last $hours.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
when a variable name is used in a it is silently declared as a new masking the global
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
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
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
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
static isMetadataKey( $key)
Test whether a key should be considered metadata.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
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
getMain()
Get the main module.
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 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 "<
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 newFromID( $id, $flags=0)
Create a new Title from an article ID.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
the array() calling protocol came about after MediaWiki 1.4rc1.