|
MediaWiki master
|
Public Member Functions | |
| __construct (private readonly ServiceOptions $options, HookContainer $hookContainer, private readonly UserFactory $userFactory, private readonly IContextSource $context, private readonly UserRequirementsConditionValidator $userRequirementsConditionValidator, private readonly array UserRequirementsConditionEvaluatorBase[] $evaluators=[],) | |
| extractConditions ( $cond) | |
| Goes through a condition passed as the input and extracts all simple conditions that are used within it. | |
| extractPrivateConditions ( $cond) | |
| Goes through a condition passed as the input and extracts all private conditions that are used within it. | |
| recursivelyCheckCondition ( $cond, UserIdentity $user, bool $usePrivateConditions=true) | |
| Recursively check a condition. | |
Public Attributes | |
| const | CONSTRUCTOR_OPTIONS |
| const | VALID_OPS = [ '&', '|', '^', '!' ] |
| Logical operators recognized in $wgAutopromote. | |
Protected Member Functions | |
| checkCondition (array $cond, UserIdentity $user) | |
| As recursivelyCheckCondition, but not recursive. | |
Definition at line 21 of file UserRequirementsConditionChecker.php.
| MediaWiki\User\UserRequirementsConditionChecker::__construct | ( | private readonly ServiceOptions | $options, |
| HookContainer | $hookContainer, | ||
| private readonly UserFactory | $userFactory, | ||
| private readonly IContextSource | $context, | ||
| private readonly UserRequirementsConditionValidator | $userRequirementsConditionValidator, | ||
| private readonly array UserRequirementsConditionEvaluatorBase[] | $evaluators = [] ) |
Definition at line 37 of file UserRequirementsConditionChecker.php.
|
protected |
As recursivelyCheckCondition, but not recursive.
The only valid conditions are those whose first element is one of APCOND_* defined in Defines.php. Other types will throw an exception if no extension evaluates them.
| array | $cond | A condition, which must not contain other conditions. This array must contain at least one item, which is the condition type. |
| UserIdentity | $user | The user to check the condition against |
| InvalidArgumentException | if autopromote condition was not recognized. |
| LogicException | if APCOND_BLOCKED is checked again before returning a result. |
Definition at line 63 of file UserRequirementsConditionChecker.php.
| MediaWiki\User\UserRequirementsConditionChecker::extractConditions | ( | $cond | ) |
Goes through a condition passed as the input and extracts all simple conditions that are used within it.
Simple condition is any condition that is not a logical operator, for example APCOND_EDITCOUNT is a simple condition.
| mixed | $cond | A condition, possibly containing other conditions. |
Definition at line 246 of file UserRequirementsConditionChecker.php.
| MediaWiki\User\UserRequirementsConditionChecker::extractPrivateConditions | ( | $cond | ) |
Goes through a condition passed as the input and extracts all private conditions that are used within it.
| mixed | $cond | A condition, possibly containing other conditions. |
Definition at line 230 of file UserRequirementsConditionChecker.php.
| MediaWiki\User\UserRequirementsConditionChecker::recursivelyCheckCondition | ( | $cond, | |
| UserIdentity | $user, | ||
| bool | $usePrivateConditions = true ) |
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 checkCondition for evaluation of the latter type.
If you change the logic of this method, please update ApiQuerySiteinfo::appendAutoPromote(), as it depends on this method.
If the passed condition is invalid, false is returned without evaluating it.
| mixed | $cond | A condition, possibly containing other conditions |
| UserIdentity | $user | The user to check the conditions against |
| bool | $usePrivateConditions | Whether to evaluate private conditions |
Definition at line 125 of file UserRequirementsConditionChecker.php.
| const MediaWiki\User\UserRequirementsConditionChecker::CONSTRUCTOR_OPTIONS |
Definition at line 31 of file UserRequirementsConditionChecker.php.
Referenced by MediaWiki\User\UserRequirementsConditionCheckerFactory\__construct().
| const MediaWiki\User\UserRequirementsConditionChecker::VALID_OPS = [ '&', '|', '^', '!' ] |
Logical operators recognized in $wgAutopromote.
Definition at line 28 of file UserRequirementsConditionChecker.php.