41 if ( self::recCheckCondition( $cond, $user ) ) {
46 Hooks::run(
'GetAutoPromoteGroups', [ $user, &$promote ] );
69 $currentGroups = $user->getGroups();
70 $formerGroups = $user->getFormerGroups();
73 if (
in_array( $group, $currentGroups ) ) {
77 if (
in_array( $group, $formerGroups ) ) {
81 if ( self::recCheckCondition( $cond, $user ) ) {
107 $validOps = [
'&',
'|',
'^',
'!' ];
109 if (
is_array( $cond ) && count( $cond ) >= 2 &&
in_array( $cond[0], $validOps ) ) {
110 # Recursive condition
111 if ( $cond[0] ==
'&' ) {
113 if ( !self::recCheckCondition( $subcond, $user ) ) {
119 }
elseif ( $cond[0] ==
'|' ) {
121 if ( self::recCheckCondition( $subcond, $user ) ) {
127 }
elseif ( $cond[0] ==
'^' ) {
128 if ( count( $cond ) > 3 ) {
129 wfWarn(
'recCheckCondition() given XOR ("^") condition on three or more conditions.' .
130 ' Check your $wgAutopromote and $wgAutopromoteOnce settings.' );
134 }
elseif ( $cond[0] ==
'!' ) {
136 if ( self::recCheckCondition( $subcond, $user ) ) {
165 if ( count( $cond ) < 1 ) {
169 switch ( $cond[0] ) {
171 if ( Sanitizer::validateEmail( $user->getEmail() ) ) {
173 return (
bool)$user->getEmailAuthenticationTimestamp();
180 $reqEditCount = $cond[1];
183 if ( $reqEditCount <= 0 ) {
189 return $age >= $cond[1];
192 return $age >= $cond[1];
195 return count(
array_intersect( $groups, $user->getGroups() ) ) == count( $groups );
197 return $cond[1] == $user->getRequest()->getIP();
199 return IP::isInRange( $user->getRequest()->getIP(), $cond[1] );
201 return $user->isBlocked();
206 Hooks::run(
'AutopromoteCondition', [ $cond[0],
208 if ( $result ===
null ) {
209 throw new MWException(
"Unrecognized condition {$cond[0]} for autopromotion!" );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgAutopromote
Array containing the conditions of automatic promotion of a user to specific groups.
$wgEmailAuthentication
Require email authentication before sending mail to an email address.
$wgAutopromoteOnce
Automatically add a usergroup to any user who matches certain conditions.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static getGroupPermissions( $groups)
Get the permissions associated with a given list of groups.
namespace being checked & $result
const APCOND_EMAILCONFIRMED
const APCOND_AGE_FROM_EDIT