扩展:Echo

This page is a translated version of the page Extension:Echo and the translation is 17% complete.
MediaWiki的扩展的手冊
Echo
發佈狀態: 穩定版本
实现 通知
描述 提供了一个wiki内部可以供其他扩展使用的通知系统。
作者
最新版本 持续更新
兼容性政策 快照跟随MediaWiki发布。 master分支不向後兼容。
MediaWiki >= 1.40.0
数据库更改
echo_email_batch
echo_event
echo_notification
echo_subscription
echo_target_page
echo_push_provider
echo_push_subscription
echo_push_topic
许可协议 MIT授權條款
下載
  • $wgEchoNotificationCategories
  • $wgEchoEventLoggingSchemas
  • $wgEchoMaxMentionsCount
  • $wgEchoPerUserWhitelistFormat
  • $wgEchoPushMaxSubscriptionsPerUser
  • $wgEchoMentionOnChanges
  • $wgEchoPollForUpdates
  • $wgEchoUseJobQueue
  • $wgEchoBundleEmailInterval
  • $wgEchoMentionsOnMultipleSectionEdits
  • $wgDefaultNotifyTypeAvailability
  • $wgEchoSecondaryIcons
  • $wgEchoCacheVersion
  • $wgEchoMaxUpdateCount
  • $wgEchoNotifiers
  • $wgEchoAgentBlacklist
  • $wgEchoSharedTrackingCluster
  • $wgEchoEnablePush
  • $wgEchoPerUserBlacklist
  • $wgEchoEnableEmailBatch
  • $wgEchoWatchlistNotifications
  • $wgNotifyTypeAvailabilityByCategory
  • $wgEchoMaxMentionsInEditSummary
  • $wgEchoNotifications
  • $wgEchoPushServiceBaseUrl
  • $wgEchoCluster
  • $wgEchoWatchlistEmailOncePerPage
  • $wgAllowArticleReminderNotification
  • $wgEchoEventLoggingVersion
  • $wgEchoNotificationIcons
  • $wgEchoSharedTrackingDB
  • $wgEchoOnWikiBlacklist
  • $wgEchoSeenTimeCacheType
  • $wgEchoMentionStatusNotifications
  • $wgEchoCrossWikiNotifications
  • $wgEchoEmailFooterAddress
季度下載量 304 (Ranked 37th)
公開的wiki使用 2,698 (Ranked 187th)
翻譯Echo的扩展,若在translatewiki.net可用
問題 尚未完成的工作 · 报告錯誤

Echo 扩展提供了一个 wiki 内部可以供其他扩展使用的通知系统。 扩展:感谢 扩展:结构式讨论 是两个使用了 Echo 的 MediaWiki 扩展。 通知 里描述了这个扩展能做的事情的完整描述。


下载

此扩展可直接从Git检索到 [?]:

  • 浏览代码
  • 部分扩展有稳定版本标签。
  • 每个分支与过去的MediaWiki发布版本相关联。 这里也有一个“主线”分支,包含最新alpha版本(可能需要MediaWiki的alpha版本)。

提取快照,并将它放置在您的MediaWiki安装副本的extensions/Echo/目录中。

如果您对git熟悉,并且拥有您服务器的shell访问权,您也可以通过以下方法获得扩展:

cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo.git

该扩展的 master 分支只支持 MediaWiki 核心的 master 分支(目前为 1.39+)。 要与 1.32–1.38 一起使用,您必须切换到匹配的分支(例如 Echo REL1_38 与 MediaWiki 核心 REL1_38)。

安装

  • 数据库用户必须已被授予数据库的“REFERENCES”权限。
  • 下载文件,并将其放置在您extensions/文件夹中的Echo目录内。
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'Echo' );
    
  • 运行更新脚本,它将自动创建此扩展必须依赖的数据库表。
  • 在您方便的时候配置即可
  •   完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

为了允许每天或每周通过邮件发送摘要通知(对于在首选项中选择的用户),Echo 扩展目录中的以下脚本需要每天运行,可以在 cron 作业中安排:

maintenance/processEchoEmailBatch.php

配置

除了设置默认的用户偏好之外,您也可以使用AddNewAccount 钩子在注册的时候更改用户偏好。 这允许设置以后用户不同的偏好,而不会影响已有用户。

有关更多详细信息,请参见 Special:DisplayNotificationsConfiguration

Parameters

Configuration settings (defaults defined in extension.json)
Parameter 默认 评论
$wgEchoEnableEmailBatch true Whether to turn on email batch function
$wgEchoUseJobQueue false
  • true - Defer web and email notification delivery via job queue.
  • false - Deliver notifications immediately
$wgEchoEmailFooterAddress '' The organization address (or whatever text you want to appear in the footer of the email notifications). Should be defined in LocalSettings.php
$wgNotificationSender $wgPasswordSender The email address for both "from" and "reply to" on email notifications. Should be defined in LocalSettings.php
$wgNotificationSenderName "emailsender" message (MediaWiki) Name for "from" on email notifications. Should be defined in LocalSettings.php
$wgNotificationReplyName No Reply Name for "reply to" on email notifications. Should be defined in LocalSettings.php
$wgEchoCluster false Use the main db if this is set to false, to use a specific external db, just use any key defined in $wgExternalServers
$wgEchoSharedTrackingDB false Shared database to use for keeping track of cross-wiki unread notifications; false to not keep track of it at all
$wgEchoSharedTrackingCluster false Cluster the shared tracking database is located on; false if it is on the main one. Must be a key defined in $wgExternalServers
$wgEchoMaxUpdateCount 2000 The max number of notifications allowed for a user to do a live update, this is also the number of max notifications allowed for a user to have.
$wgEchoMaxMentionsCount 50 The max number of mention notifications allowed for a user to send at once
$wgEchoMentionStatusNotifications false Enable mention success/failure notifications
$wgEchoMentionsOnMultipleSectionEdits true Trigger mentions for multiple-section edits
$wgEchoMentionOnChanges true Trigger mentions for edits to existing comments, as long as a signature is added in the same section
$wgEchoMaxMentionsInEditSummary 0 Maximum number of users that will be notified that they were linked from an edit summary or 0 for no notifications
$wgEchoBundleEmailInterval 0 The time interval between each bundle email in seconds; set a small number for test wikis. This should be set to 0 to disable email bundling if there is no delay queue support
$wgEchoNewMsgAlert true Whether or not to enable a new talk page message alert for logged in users.
$wgEchoShowFooterNotice false Whether or not to show the footer feedback notice in the notifications popup
$wgEchoFooterNoticeURL '' A URL for the survey that appears in the footer feedback notice in the notification popup
$wgNotifyTypeAvailabilityByCategory
[
	// Otherwise, a user->user email could trigger an additional redundant notification email.
	'emailuser' => [
		'web' => true,
		'email' => false,
	],
	'mention-failure' => [
		'web' => true,
		'email' => false,
	],
	'mention-success' => [
		'web' => true,
		'email' => false,
	],
]
Define which notify types are available for each notification category. If any notify types are omitted, it defaults to $wgDefaultNotifyTypeAvailability.
$wgEchoNotifiers
[
	'web' => [ 'EchoNotifier', 'notifyWithNotification' ],
	'email' => [ 'EchoNotifier', 'notifyWithEmail' ],
]
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;

$wgEchoNotificationCategories See extension.json 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.

$wgEchoNotificationIcons See extension.json 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']

$wgEchoNotifications See extension.json Define the event types for echo. Event definitions are in the form of 'event-name' => [ ... ].
  • category - defines the category the event belongs to. Defaults to 'other'.
  • group - defaults to 'neutral'.
  • bundle - define which output formats are available for bundling.
  • presentation-model - define which class is used to render notification messages and links for notification panels, special page and emails. It must extend EchoEventPresentationModel.
$wgEchoConfig See extension.json Configuration for EventLogging. Individual schemas can be disabled.
$wgEchoPerUserBlacklist null Boolean that enabled Per User Blacklist.

User preferences

Preference settings (defaults defined in extension.json)
Preference Default Comment
$wgDefaultUserOptions['echo-show-alert'] true Default user preference for showing the special talk page alert bar
$wgDefaultUserOptions['echo-email-frequency'] 0 How often to send emails, by default:
  • 0 - send emails for each notification as they come in (default)
  • -1 - do not send emails
  • 1 - each day
  • 7 - each 7 days
  • ...
$wgDefaultUserOptions['echo-dismiss-feedback-alert'] 0 Ensures the feedback alert is visible by default. Do not change; to disable, use $wgEchoShowFooterNotice.
$wgDefaultUserOptions['echo-email-format'] Depends on $wgAllowHTMLEmail Default user preference for whether to use HTML or text email. Either html or plain-text.
$wgDefaultUserOptions["echo-subscriptions-email-{$category}"] false for most categories; depends Default user preference for whether to notify via email for a particular category
$wgDefaultUserOptions["echo-subscriptions-web-{$category}"] true for most categories; depends Default user preference for whether to notify via web for a particular category

架构

用法

Notification negative list / positive list

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 = [ 'SampleBot', 'SampleUser' ];

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:

SampleBot
SampleUser
"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.

术语

  • notification - Any individual notice that is delivered by Echo
  • message - A notification about activity in a Flow discussion
  • alert - Any notification other than a message

參見