|
MediaWiki 1.44.0
|
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. | |
| 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 |
| 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. Use newFromIP() to apply normalization, for example stripping leading zeroes.
| string | $ip |
Definition at line 273 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 241 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 121 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 157 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 181 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 195 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 135 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 288 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 256 of file BlockTargetFactory.php.
| const MediaWiki\Block\BlockTargetFactory::CONSTRUCTOR_OPTIONS |
Definition at line 41 of file BlockTargetFactory.php.