Manual:$wgAutopromote

This page is a translated version of the page Manual:$wgAutopromote and the translation is 81% complete.
アクセス権: $wgAutopromote
利用者が特定のグループに自動昇格する条件
導入されたバージョン:1.12.0 (r28797)
除去されたバージョン:使用中
許容される値:(配列)
既定値:(下記参照)

詳細

この配列では自動昇格の条件を設定します。構文は以下の通りです:

$wgAutopromote = [
    'groupname' => cond,
    'group2' => cond,
];

cond には以下を指定できます:

Possible conditions

使用できる条件 (Defines.php 内で定義されており、拡張機能が AutopromoteCondition フックで他の条件を追加する場合があります):

条件 説明 引数
APCOND_EDITCOUNT 最低限必要な編集回数
If null or missing $wgAutoConfirmCount will be used
整数
APCOND_AGE 登録からの経過秒数の最小値 If null or missing $wgAutoConfirmAge will be used 整数
APCOND_EMAILCONFIRMED メールアドレスが確認済み (利用不可)
APCOND_INGROUPS 利用者が所属すべきグループの列挙 例:, 'sysop', 'bureaucrat', 'bot'
APCOND_ISIP 利用者が特定の IP アドレスを持つ 例:, '1.2.3.4' or '2001:0db8:85a3::7344'
APCOND_IPINRANGE 利用者が特定の IP レンジに所属 Manual:IP 範囲 を参照
APCOND_AGE_FROM_EDIT 最初の編集からの経過秒数の最小値 整数
APCOND_BLOCKED アカウントがブロックされている (バージョン 1.16 r52083 で追加) (利用不可)
APCOND_ISBOT アカウントがボットである (利用不可)

引数がある条件とない条件

各条件は 2 通りの書式で書けます:

APCOND_EMAILCONFIRMED   # 引数がない条件
array( APCOND_EDITCOUNT, 100 )   # 引数がある条件

条件の集合

条件の集合の構文は以下の通りです:

[ 'operand', cond1, cond2, ... ];

4 つのオペランド (operand) を利用できます:

  • & (AND) — 利用者がすべての条件を満たす場合に昇格する。
  • | (OR) — 利用者がどれかの条件を満たす場合に昇格する。
  • ^ (XOR) — 利用者が2つのうち1つだけの条件を満たす場合に昇格する。
  • ! (NOT) — 利用者がどの条件も満たさない場合に昇格する。

条件の集合は再帰的に評価されるため、オペランドで接続することで、条件の集合の入れ子を使用できます。

Caveats

Autopromotion does not actually add users to a group; MediaWiki will check whether a user meets the conditions for autopromotion whenever it checks the user's rights or effective groups. This means that a user will only appear to be in a group on Special:ListUsers if they were added to it through Special:UserRights.

Since MediaWiki 1.18 you can use AutopromoteOnce instead, which adds users normally to a group, if they match the given criteria and have not been demoted before. Alternatively, $wgRevokePermissions (MW 1.16+) might be useful for you.

Temporary users cannot be autopromoted, since they cannot be assigned to user groups.


既定値

MediaWiki バージョン:
1.38
$wgAutopromote = [
	'autoconfirmed' => [ '&',
		[ APCOND_EDITCOUNT, null],
		[ APCOND_AGE, null ],
	],
];
MediaWiki バージョン:
1.13 – 1.37
$wgAutopromote = [
	'autoconfirmed' => [ '&',
		[ APCOND_EDITCOUNT, &$wgAutoConfirmCount ],
		[ APCOND_AGE, &$wgAutoConfirmAge ],
	],
];
MediaWiki バージョン:
1.12
$wgAutopromote = array(
	'autoconfirmed' => array( '&',
		array( APCOND_EDITCOUNT, &$wgAutoConfirmCount ),
		array( APCOND_AGE, &$wgAutoConfirmAge ),
	),
	'emailconfirmed' => APCOND_EMAILCONFIRMED,
);

If you wanted to autopromote each user to captain upon their having both confirmed their email address and either made at least 100 edits or registered their account at least 60 days ago, you would use:

$wgAutopromote = [
	'captain' => [
		'&',
		APCOND_EMAILCONFIRMED,
		[
			'|',
			[ APCOND_EDITCOUNT, 100 ],
			[ APCOND_AGE, 60*86400 ],
		],
	],
];

Note that this would get rid of all other autopromote groups; to instead add the captain autopromote group while keeping those autopromote groups that already exist, one would use:

$wgAutopromote['captain'] = [
	'&',
	APCOND_EMAILCONFIRMED,
	[
		'|',
		[ APCOND_EDITCOUNT, 100 ],
		[ APCOND_AGE, 60*86400 ],
	],
];

関連項目