Manual:$wgRCFeeds/zh

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
<translate> Recent changes, new pages, watchlist and history</translate>: $wgRCFeeds
Configuration for sending RC updates
<translate> Introduced in version:</translate>1.22.0 (Gerrit change 52922; git #2961884b)
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate><translate> Unspecified</translate>
<translate> Default value:</translate>[]

细节

This variable is for configuring where MediaWiki will send network updates for recent changes. This is called after recent changes info have been inserted into the recentchanges table.

Setting a feed requires the sockets PHP extension. If the extension is not enabled, actions like edits, moves, etc may work, but the action may not get logged in recent changes at all (<translate> task <tvar name=1>T185428</tvar></translate>).

用法

MediaWiki supports sending recent changes updates to any number of destinations. Therefore this variable is an array, with each entry being a descriptor of where and how to send the data.

Each descriptor is an associative array with the following keys:

formatter
Fully qualified class name for the class that will format the data for sending over the network. It must inherit the RCFeedFormatter interface.
uri
URI to send the data to (the protocol indicates what engine is used to send the data)
omit_bots
True or false whether to skip bot edits
omit_anon
True or false whether to skip anon edits
omit_user
True or false whether to skip registered users
omit_minor
True or false whether to skip minor edits
omit_patrolled
True or false whether to skip patrolled edits

As mentioned, the formatter key specifies what class will be used to format the data, and the protocol of the URI specifies how to actually send the data.

Formatters

A formatter needs to be specified in order for the data to be translated properly before going over the network. MediaWiki has the following built-in formatter classes:

JSONRCFeedFormatter
Outputs the RC information in a JSON dictionary
XMLRCFeedFormatter
Outputs the RC information in XML format
IRCColourfulRCFeedFormatter
Outputs an IRC line with color codes for broadcast to an IRC server
Custom parameters:
add_interwiki_prefix
True or false whether to add the interwiki prefix to the data ($wgLocalInterwikis ). Only works for the IRCColourfulRCFeedFormatter formatter.

Engines

Engines are the method by which the recentchange notifications are sent. MediaWiki has the following built-in engines:

UDPRCFeedEngine
Sends via a UDP packet
RedisPubSubFeedEngine
Sends via Redis Pub/Sub

有关如何配置协议到引擎的映射,请参见$wgRCEngines

-{zh-hans:示例; zh-hant:範例;}-

以下是一些示例配置:

$wgRCFeeds['example'] = [
	'class' => UDPRCFeedEngine::class,
	'uri' => 'udp://localhost:1336',
	'formatter' => JSONRCFeedFormatter::class,
	'omit_bots' => true,
];

$wgRCFeeds['example'] = [
	'class' => ExampleRCFeed::class,
];

参见