|
MediaWiki master
|
Factory for BlockTarget objects. More...
Inherits MediaWiki\DAO\WikiAwareEntity.

Public Member Functions | |
| __construct (ServiceOptions $options, UserIdentityLookup $userIdentityLookup, UserNameUtils $userNameUtils, string|false $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. | |
| newFromIp (string $ip) | |
| Try to create a block target from a single IP address. | |
| 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. | |
Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | |
| assertWiki ( $wikiId) | |
| Throws if $wikiId is different from the return value of getWikiId(). | |
Public Attributes | |
| const | CONSTRUCTOR_OPTIONS |
Public Attributes inherited from MediaWiki\DAO\WikiAwareEntity | |
| const | LOCAL = false |
| Wiki ID value to use with instances that are defined relative to the local wiki. | |
| MediaWiki\Block\BlockTargetFactory::__construct | ( | ServiceOptions | $options, |
| UserIdentityLookup | $userIdentityLookup, | ||
| UserNameUtils | $userNameUtils, | ||
| string|false | $wikiId = Block::LOCAL ) |
Definition at line 44 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 58 of file BlockTargetFactory.php.
| MediaWiki\Block\BlockTargetFactory::newAnonIpBlockTarget | ( | string | $ip | ) |
Create an IP block target.
A simple constructor proxy for pre-validated input. Use newFromIP() to apply normalization, for example stripping leading zeroes.
| string | $ip |
Definition at line 267 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 235 of file BlockTargetFactory.php.
| MediaWiki\Block\BlockTargetFactory::newFromIp | ( | string | $ip | ) |
Try to create a block target from a single IP address.
| string | $ip |
Definition at line 115 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 151 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 175 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 189 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 68 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 129 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 282 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 250 of file BlockTargetFactory.php.
| const MediaWiki\Block\BlockTargetFactory::CONSTRUCTOR_OPTIONS |
Definition at line 40 of file BlockTargetFactory.php.