MediaWiki REL1_34
Autopromote Class Reference

This class checks if user can get extra rights because of conditions specified in $wgAutopromote. More...

Static Public Member Functions

static getAutopromoteGroups (User $user)
 Get the groups for the given user based on $wgAutopromote.
 
static getAutopromoteOnceGroups (User $user, $event)
 Get the groups for the given user based on the given criteria.
 

Static Private Member Functions

static checkCondition ( $cond, User $user)
 As recCheckCondition, but not recursive.
 
static recCheckCondition ( $cond, User $user)
 Recursively check a condition.
 

Detailed Description

This class checks if user can get extra rights because of conditions specified in $wgAutopromote.

Definition at line 30 of file Autopromote.php.

Member Function Documentation

◆ checkCondition()

static Autopromote::checkCondition (   $cond,
User  $user 
)
staticprivate

As recCheckCondition, but not recursive.

The only valid conditions are those whose first element is APCOND_EMAILCONFIRMED/APCOND_EDITCOUNT/ APCOND_AGE. Other types will throw an exception if no extension evaluates them.

Parameters
array$condA condition, which must not contain other conditions
User$userThe user to check the condition against
Exceptions
MWException
Returns
bool Whether the condition is true for the user

Definition at line 165 of file Autopromote.php.

References $wgEmailAuthentication, APCOND_AGE, APCOND_AGE_FROM_EDIT, APCOND_BLOCKED, APCOND_EDITCOUNT, APCOND_EMAILCONFIRMED, APCOND_INGROUPS, APCOND_IPINRANGE, APCOND_ISBOT, APCOND_ISIP, User\getBlock(), User\getEditCount(), User\getEmail(), User\getEmailAuthenticationTimestamp(), User\getFirstEditTimestamp(), User\getGroups(), getPermissionManager(), User\getRegistration(), User\getRequest(), and wfTimestampOrNull().

Referenced by recCheckCondition().

◆ getAutopromoteGroups()

static Autopromote::getAutopromoteGroups ( User  $user)
static

Get the groups for the given user based on $wgAutopromote.

Parameters
User$userThe user to get the groups for
Returns
array Array of groups to promote to.

Definition at line 37 of file Autopromote.php.

References $wgAutopromote.

Referenced by User\getAutomaticGroups(), and UserrightsPage\showEditUserGroupsForm().

◆ getAutopromoteOnceGroups()

static Autopromote::getAutopromoteOnceGroups ( User  $user,
  $event 
)
static

Get the groups for the given user based on the given criteria.

Does not return groups the user already belongs to or has once belonged.

Parameters
User$userThe user to get the groups for
string$eventKey in $wgAutopromoteOnce (each one has groups/criteria)
Returns
array Groups the user should be promoted to.
See also
$wgAutopromoteOnce

Definition at line 65 of file Autopromote.php.

References $wgAutopromoteOnce, User\getFormerGroups(), and User\getGroups().

Referenced by User\addAutopromoteOnceGroups().

◆ recCheckCondition()

static Autopromote::recCheckCondition (   $cond,
User  $user 
)
staticprivate

Recursively check a condition.

Conditions are in the form [ '&' or '|' or '^' or '!', cond1, cond2, ... ] where cond1, cond2, ... are themselves conditions; OR APCOND_EMAILCONFIRMED, OR [ APCOND_EMAILCONFIRMED ], OR [ APCOND_EDITCOUNT, number of edits ], OR [ APCOND_AGE, seconds since registration ], OR similar constructs defined by extensions. This function evaluates the former type recursively, and passes off to self::checkCondition for evaluation of the latter type.

Parameters
mixed$condA condition, possibly containing other conditions
User$userThe user to check the conditions against
Returns
bool Whether the condition is true

Definition at line 108 of file Autopromote.php.

References checkCondition(), recCheckCondition(), and wfWarn().

Referenced by recCheckCondition().


The documentation for this class was generated from the following file: