Extension:Comments
![]() リリースの状態: 安定 |
|
---|---|
![]() |
|
実装 | パーサー拡張機能 , フック |
説明 | 記事にコメントできるようにする <comments /> パーサー フック タグを追加する |
作者 |
|
最新バージョン | 4.6.0 (2019-08-08) |
MediaWiki | 1.39+ |
データベースの変更 | はい |
テーブル | Comments Comments_Vote Comments_block |
ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
ダウンロード | |
例 | ソーシャルツール開発ウィキ |
|
|
<comments /> |
|
Quarterly downloads | 134 (Ranked 77th) |
Public wikis using | 194 (Ranked 412nd) |
translatewiki.net で翻訳を利用できる場合は、Comments 拡張機能の翻訳にご協力ください | |
問題点 | 未解決のタスク · バグを報告 |
Extension:Commentsは、<comments />
パーサーフックタグを追加して、タグが存在する記事にコメントできるようにします。
Comment actions are logged to Special:Log/comments
, but by default they're hidden, just like patrol log entries.
$wgCommentsInRecentChanges = true;
を設定して、コメントの記録項目をを Special:RecentChanges で表示できます (バージョン 2.8 以降で利用可能)。
コード修正の大部分はMiszaとJack Phoenixで行われました。
インストール
- ダウンロードして、ファイルを
extensions/
フォルダー内のComments
という名前のディレクトリ内に配置します。 - 以下のコードを
LocalSettings.php
の末尾に追加します:wfLoadExtension( 'Comments' );
- 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
- 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
使用法
<comments />
— 基本的なコメントフォーム。ほとんどの場合に十分です。<comments allow="Derfel,Jack Phoenix,Misza" />
— ユーザーDerfel、Jack Phoenix、Miszaのみがコメントを送信できます。<comments voting="Plus" />
— ユーザーがコメントを否定的(賛成)に評価するのを防ぎ、肯定的(賛成)投票のみを許可します。
今日のコメント
この拡張機能には、「Comments of the Day」(訳:今日のコメント)機能(<commentsoftheday />
)が付属しており、デフォルトでは「無効」になっています。
require_once
行の後に以下を追加することにより、WikiのLocalSettings.php
でこの機能を有効にできます。
require_once "$IP/extensions/Comments/CommentsOfTheDay.php";
nocache
引数がパーサーフック(<commentsoftheday nocache=true />
のように)に渡される場合、
パーサーフックはmemcachedを使用せず、キャッシュではなくデータベースからデータをフェッチするだけです。
最新のデータを表示する場合に役立ちますが、サーバーに非常に負荷がかかる可能性があります。
利用者権限
この拡張機能は、以下の新しい利用者権限を追加します:
comment
- (コメントを投稿できます)commentlinks
- (コメントに外部リンクを投稿できます)commentadmin
- 利用者が投稿したコメントを削除できますcomment-delete-own
- which allows deleting one's own comments, e.g.
$wgGroupPermissions['sysop']['commentadmin'] = true;
既定では、匿名利用者も含め、誰でもコメントを投稿できますが、外部リンクを含むコメントの投稿は自動承認された利用者に制限されています。
匿名利用者が外部リンクを投稿できるようにする場合は、require_once
の後に以下を追加します:
$wgGroupPermissions['*']['commentlinks'] = true;
デフォルトでは、commentadmin
グループのユーザーのみがコメントを削除できます。
利用者ポイント
$wgUserStatsPointValues['comment_plus']
— amount of points to give out when another user gives "thumbs up" to your comment.$wgUserStatsPointValues['comment_ignored']
— amount of points to give out when another user adds your comments to their ignore list (Special:CommentIgnoreList).
パラメーター
$wgCommentsDefaultAvatar
— path to an image which will be displayed instead of an avatar if social tools (SocialProfile extension) aren't installed. Should be 50x50px. Note that there is no default avatar image shipped with this extension. The default is defined inextension.json
and links to an external image onshoutwiki.com
server, 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 totrue
to 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 totrue
to sort comments by date descending, with the new comment box and most recent comments at the top.
魔法の言葉/パーサー機能
コメントには、2つの魔法の言葉とパーサー機能が含まれています。
{{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 into the database, on 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.
|
|
国際化
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 into your language.
やることリスト
- HTML output is not valid XHTML - would be nice if it were but we can live without that
- Would be nice if there was a special page that gives a overview of all uses of the Comments extension on all pages (for an adminstrator to be able to moderate easier)
関連項目
この拡張機能は以下のパッケージ/ウィキファームに含まれています: This is not an authoritative list. Some wiki farms/hosts may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |