The Echo extension provides an in-wiki notification system that can be used by other extensions.
扩展:感谢 and StructuredDiscussions are two MediaWiki extensions that make use of Echo.
See Notifications for a full description of what this extension does.

配置

In addition to setting default user preferences, you can also use the AddNewAccount hook to change user preferences on signup.
That allows setting different user preferences going forward without affecting existing users.

Definitions of the different types of notification delivery that are possible. Each definition consists of a class name and a function name. See also: EchoNotificationController class.

$wgEchoAgentBlacklist

[]

List of usernames which will not trigger notifications

$wgEchoOnWikiBlacklist

Echo-blacklist

Page location of community maintained blacklist within NS_MEDIAWIKI containing one username per line which will not trigger notifications. Set to null to disable.

$wgEchoPerUserWhitelistFormat

%s/Echo-whitelist

An sprintf format of the location of the per-user notification agent whitelist within the NS_USER namespace. %s will be replaced with the users name. The whitelists must contain one username per line which will always trigger notifications regardless of their existence in the blacklists. Set to null to disable.

$wgEchoCrossWikiNotifications

false

Whether to enable the cross-wiki notifications feature. To enable this feature you need to:

have a global user system (e.g. CentralAuth or a shared user table)

have $wgMainStash and $wgMainWANCache shared between wikis

configure $wgEchoSharedTrackingDB

$wgEchoUseCrossWikiBetaFeature

false

Feature flag for the cross-wiki notifications beta feature

If this is true, the cross-wiki notifications preference will appear in the BetaFeatures section; if this is false, it'll appear in the Notifications section instead.

This does not control whether cross-wiki notifications are enabled by default. For that, use $wgDefaultUserOptions['echo-cross-wiki-notifications'] = true;

Define the categories that notifications can belong to. Categories can be assigned the following parameters. All parameters are optional:

priority: Controls the order in which notifications are displayed in preferences and batch emails. Priority ranges from 1 to 10. If the priority is not specified, it defaults to 10, which is the lowest.

no-dismiss: disables the dismissability of notifications in the category. It can either be set to an array of output formats (see $wgEchoNotifiers) or an array containing 'all'.

usergroups: Specifies an array of usergroups eligible to receive the notifications in the category. If no usergroups parameter is specified, all groups are eligible.

If a notifications type doesn't have a category parameter, it is automatically assigned to the other category which is lowest priority and has no preferences or dismissibility.

Defines icons, which are 30x30 images. This is passed to BeforeCreateEchoEvent so extensions can define their own icons with the same structure. It is recommended that extensions prefix their icon key. An example is myextension-name. This will help avoid namespace conflicts.

You can use either a path or a url, but not both. The value of 'path' is relative to $wgExtensionAssetsPath.

The value of 'url' should be a URL.

You should customize the site icon URL, which is: $wgEchoNotificationIcons['site']['url']

架构

用法

Notification blacklist/whitelist

There are occasionally specific users, typically bots, which perform maintenance tasks that should not generate notifications.
To handle these cases, users can be globally blacklisted from the LocalSettings.php file (or InitialiseSettings.php in the case of WMF wikis):

$wgEchoAgentBlacklist=['GonzoBot','CrazyGuy'];

There is also an on-wiki blacklist that can be maintained by the wiki's community.
The location of the global on-wiki blacklist defaults to MediaWiki:Echo-blacklist.
Individual users can override the blacklist by creating a whitelist.
The whitelist location defaults to Special:MyPage/Echo-whitelist.
All on-wiki lists expect to receive one case-specific username per line with no special markup or prefixes.
For example:

GonzoBot
CrazyGuy

"Mention" option

One of the notification types that this extension allows is: "Notify me when someone links to my user page." It might not be obvious to some users, but this particular notification only works when the person linking to another user's page also signs (~~~~) the post.

After installation of the extension, a new tab "Notifications" is created in a user's Special:Preferences page. Under the section "Notify me about these events", in front of the "Mention" option, the hoverbox states: "Notify me when someone links to my user page." If an administrator feels, that the requirement for signing the post isn't obvious in this help text, it can be modified by changing the text in the Wiki's MediaWiki:Echo-pref-tooltip-mention page.