MediaWiki master
|
Factory for BlockTarget objects. More...
Inherits MediaWiki\DAO\WikiAwareEntity.
Public Member Functions | |
__construct (ServiceOptions $options, UserIdentityLookup $userIdentityLookup, UserNameUtils $userNameUtils, $wikiId=Block::LOCAL) | |
getWikiId () | |
Get the ID of the wiki this page belongs to. | |
newAnonIpBlockTarget (string $ip) | |
Create an IP block target. | |
newAutoBlockTarget (int $id) | |
Create an AutoBlockTarget for the given ID. | |
newFromLegacyUnion ( $union) | |
Try to create a BlockTarget from a UserIdentity|string|null, a union type previously used as a target by various methods. | |
newFromRowRaw ( $row) | |
Try to create a BlockTarget from a row which must contain bt_user, bt_address and optionally bt_user_text. | |
newFromRowRedacted ( $row) | |
Try to create a BlockTarget from a row which must contain bt_auto, bt_user, bt_address and bl_id, and optionally bt_user_text. | |
newFromString (?string $str) | |
Try to create a block target from a user input string. | |
newFromUser (UserIdentity $user) | |
Create a BlockTarget from a UserIdentity, which may refer to a registered user, an IP address or range. | |
newRangeBlockTarget (string $cidr) | |
Create a range block target. | |
newUserBlockTarget (UserIdentity $user) | |
Create a UserBlockTarget for the given user. | |
![]() | |
assertWiki ( $wikiId) | |
Throws if $wikiId is different from the return value of getWikiId(). | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
MediaWiki\Block\BlockTargetFactory::__construct | ( | ServiceOptions | $options, |
UserIdentityLookup | $userIdentityLookup, | ||
UserNameUtils | $userNameUtils, | ||
$wikiId = Block::LOCAL ) |
ServiceOptions | $options | |
UserIdentityLookup | $userIdentityLookup | |
UserNameUtils | $userNameUtils | |
string | false | $wikiId |
Definition at line 51 of file BlockTargetFactory.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), MediaWiki\MainConfigNames\BlockCIDRLimit, and MediaWiki\Config\ServiceOptions\get().
MediaWiki\Block\BlockTargetFactory::getWikiId | ( | ) |
Get the ID of the wiki this page belongs to.
Implements MediaWiki\DAO\WikiAwareEntity.
Definition at line 64 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newAnonIpBlockTarget | ( | string | $ip | ) |
Create an IP block target.
A simple constructor proxy for pre-validated input.
string | $ip |
Definition at line 259 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newAutoBlockTarget | ( | int | $id | ) |
Create an AutoBlockTarget for the given ID.
A simple constructor proxy for pre-validated input.
int | $id |
Definition at line 228 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newFromLegacyUnion | ( | $union | ) |
Try to create a BlockTarget from a UserIdentity|string|null, a union type previously used as a target by various methods.
UserIdentity | string | null | $union |
Definition at line 144 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newFromRowRaw | ( | $row | ) |
Try to create a BlockTarget from a row which must contain bt_user, bt_address and optionally bt_user_text.
bt_auto is ignored, so this is suitable for permissions and for block creation but not for display.
stdClass | $row |
Definition at line 168 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newFromRowRedacted | ( | $row | ) |
Try to create a BlockTarget from a row which must contain bt_auto, bt_user, bt_address and bl_id, and optionally bt_user_text.
If bt_auto is set, the address will be redacted to avoid disclosing it. The ID will be wrapped in an AutoblockTarget.
stdClass | $row |
Definition at line 182 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newFromString | ( | ?string | $str | ) |
Try to create a block target from a user input string.
string | null | $str |
Definition at line 74 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newFromUser | ( | UserIdentity | $user | ) |
Create a BlockTarget from a UserIdentity, which may refer to a registered user, an IP address or range.
UserIdentity | $user |
Definition at line 122 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newRangeBlockTarget | ( | string | $cidr | ) |
Create a range block target.
A simple constructor proxy for pre-validated input.
string | $cidr |
Definition at line 274 of file BlockTargetFactory.php.
MediaWiki\Block\BlockTargetFactory::newUserBlockTarget | ( | UserIdentity | $user | ) |
Create a UserBlockTarget for the given user.
A simple constructor proxy for pre-validated input.
The user must be a real registered user. Use newFromUser() to create a block target from a UserIdentity which may represent an IP address.
UserIdentity | $user |
Definition at line 243 of file BlockTargetFactory.php.
const MediaWiki\Block\BlockTargetFactory::CONSTRUCTOR_OPTIONS |
Definition at line 41 of file BlockTargetFactory.php.