Расширение:Comments
Статус релиза: стабильно |
|
|---|---|
| Реализация | Расширение парсера, Хук |
| Описание | Добавляет тэг <comments />, позволяющий комментировать статьи. |
| Автор(ы) | |
| Последняя версия | 5.1 |
| MediaWiki | 1.43+ |
| Изменения в БД | Да |
|
|
<comments /> |
|
|
|
| Licence | GNU General Public License 2.0 or later |
| Скачать | |
| Переведите расширение Comments, если оно доступно на translatewiki.net | |
| Проблемы | Открытые задачи · Сообщить об ошибке |
Расширение Comments добавляет парсер <comments />, позволяющий комментировать статьи там, где этот тэг присутствует.
Действия в комментариях регистрируются в Special:Log/comments, но по умолчанию скрыты, так же как записи в журнале патрулирований.
Вы можете установить $wgCommentsInRecentChanges = true; для отображения записей в журнале комментариев в Special:RecentChanges (доступен в версии 2.8+).
Большинство фиксов были сделаны людьми Misza и Jack Phoenix
Установка
- Скачайте и распакуйте файл(ы) в папку с названием
Commentsв вашей папкеextensions/.
Вместо этого разработчикам и соавторам кода следует установить расширение из Git, используя:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Comments
- Добавьте следующий код в конце вашего файла LocalSettings.php:
wfLoadExtension( 'Comments' );
- Выполните скрипт обновления, который автоматически создаст необходимые таблицы, используемые расширением.
Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
Использование
<comments />— основная форма комментариев, достаточная для большинства вещей.<comments allow="Derfel,Jack Phoenix,Misza" />— разрешает только пользователям Derfel, Jack Phoenix и Misza представлять комментарии.<comments voting="Plus" />— препятствует пользователям отрицательно оценивать комментарии (поверх), разрешая только положительные (поверх).
Комментарии дня
Расширение также предоставляется с функцией "комментариев дня" (<commentsoftheday />), которые не включены по умолчанию.
Вы можете включить эту функцию в LocalSettings.php вики, добавив следующее после строки require_once:
require_once "$IP/extensions/Comments/CommentsOfTheDay.php";
Если аргумент nocache передается в крюк анализатора (например: <commentsoftheday nocache=true />), крюк анализатор не будет использовать memcached и будет получать данные из БД вместо кэша.
Это полезно, если вы хотите показать самые актуальные данные, но это может быть очень серверно-интенсивным.
Права участников
Это расширение добавляет следующие новые права участников:
comment- позволяющий публиковать комментарииcommentlinks- позволяющий публиковать внешние ссылки в комментарияхcommentadmin- позволяющий изменять/удалять пользовательские комментарииcomment-edit-own- позволяет редактировать собственные комментарии после публикацииcomment-delete-own- позволяющий удалять собственные комментарии, например:
$wgGroupPermissions['sysop']['commentadmin'] = true;
По умолчанию, все, даже анонимные пользователи, могут опубликовать комментарии, но публиковать комментарии с сторонними ссылками лимитированы до Special:MyLanguage/Manual:Autoconfirmed users.
Если вы хотите, чтобы анонимные пользователи могли публиковать посторонние ссылки, добавьте это после require_once:
$wgGroupPermissions['*']['commentlinks'] = true;
По умолчанию, только пользователи в группе commentadmin могут удалять комментарии.
Права участников
$wgUserStatsPointValues['comment_plus']— the number of points to give out when another user gives a "thumbs up" to your comment.$wgUserStatsPointValues['comment_ignored']— the number of points to give out when another user adds your comments to their ignore list (Special:CommentIgnoreList).
Параметры
$wgCommentsDefaultAvatar— the path to an image which will be displayed instead of an avatar if social tools (SocialProfile extension) aren't installed. It should be 50x50px. Note that there is no default avatar image shipped with this extension. The default is defined inextension.jsonand links to an external image onshoutwiki.comserver, an ad-driven wiki farm. You may prefer to set this parameter to point to a local file.$wgCommentsInRecentChanges— by default, this variable is set tofalse. Set it totrueto display comments log entries in Special:RecentChanges, too, in addition to the comments log atSpecial:Log/comments.$wgCommentsSortDescending— by default, this variable is set tofalse. Set it totrueto sort comments by date descending, with the new comment box and most recent comments at the top.$wgCommentsAbuseFilterGroup— This is the custom group name for AbuseFilter for when the AbuseFilter extension is enabled. It ensures that AbuseFilter only pulls the filters related to Comments. If you want AbuseFilter to pull all the filters, enter'default'here. The default value for this is'comment', which ensures that AbuseFilter will only look for filters specifically written to target comments.
Магические слова и функции парсера
Комментарии включают два магических слова и функцию анализа:
{{NUMBEROFCOMMENTS}}gives the entire number of comments on the wiki.{{NUMBEROFCOMMENTSPAGE}}gives number of comments on the current page.{{NUMBEROFCOMMENTSPAGE:<pagename>}}gives number of comments on the given page.
Хуки
Comments extension adds three hooks, Comment::add, Comment::delete and Comment::isSpam.
| Hook name | When it is called | Parameters |
|---|---|---|
Comment::add
|
After a comment has been added to the database, at the bottom of Comment::add function |
|
Comment::delete
|
After a comment has been deleted and the caches have been purged (function delete on class Comment)
|
|
Comment::isSpam
|
Called in Comment::isSpam before performing other spam checks.
|
|
Anti-spam
Though (as of Q3/2023) Comments does not (yet) support ConfirmEdit, MediaWiki's de facto CAPTCHA extension, there are plenty of other anti-spam measures built in, including:
- restricting who can add comments and/or comments that contain hyperlinks (see the #User rights section above)
- support for
$wgSpamRegexand$wgSummarySpamRegex - possibility for extension developers to implement custom spam checks via the
Comment::isSpamhook point (see the #Hooks section above) - AbuseFilter interoperability — AbuseFilter can be made to check if the
actionvariable's value iscommentto write filters that apply only to comments made via the Comments extension; thenew_wikitextvariable contains the actual comment text, and thenew_sizevariable is calculated on-demand based on the value of thenew_wikitextvariable. Refer to AbuseFilter's documentation for more details on how those variables and filters work.- The new configuration variable
$wgCommentsAbuseFilterGroupcan be set to'default'to make existing AbuseFilter filters apply to comments as well. By default, it is set to'comment', so only filters specifically designed to target comments will be executed against comments made via the Comments extension.
- The new configuration variable
Интернационализация
The Comments extension currently has (partial or full) support for 68 different languages, including English. Please visit translatewiki.net if you want to translate Comments or other extensions of the social tools family of extensions into your language or modify existing translations.
См. также
| Это расширение включено в следующие вики-фермы/хостинги и/или пакеты: |
- Stable extensions/ru
- Parser extensions/ru
- Hook extensions/ru
- ArticlePurge extensions/ru
- BeforeCreateEchoEvent extensions/ru
- GetMagicVariableIDs extensions/ru
- LoadExtensionSchemaUpdates extensions/ru
- ParserFirstCallInit extensions/ru
- ParserGetVariableValueSwitch extensions/ru
- GPL licensed extensions/ru
- Extensions in Wikimedia version control/ru
- All extensions/ru
- Social tools/ru
- Extensions included in Miraheze/ru
- Discussion and forum extensions/ru
