MediaWiki master
MediaWiki\Block\AnonIpBlockTarget Class Reference

A block target for a single IP address with an associated user page. More...

Inherits MediaWiki\Block\BlockTarget, MediaWiki\Block\BlockTargetWithUserPage, and MediaWiki\Block\BlockTargetWithIp.

Collaboration diagram for MediaWiki\Block\AnonIpBlockTarget:

Public Member Functions

 __construct (string $addr, $wikiId=WikiAwareEntity::LOCAL)
 
 getLogPage ()
 Get the title to be used when logging an action on this block.
 
 getSpecificity ()
 Get the score of this block for purposes of choosing a more specific block, where lower is more specific.
 
 getType ()
 Get one of the Block::TYPE_xxx constants associated with this target.
 
 getUserIdentity ()
 Get a UserIdentity associated with this target.
 
 getUserPage ()
 Get the target's user page.
 
 toHex ()
 Get the IP address in hexadecimal form.
 
 toHexRange ()
 Get the IP address as a hex "range" tuple, with the start and end equal.
 
 toString ()
 Get the username, the IP address, range, or autoblock ID prefixed with a "#".
 
 validateForCreation ()
 Check the target data against more stringent requirements imposed when a block is created from user input.
 
- Public Member Functions inherited from MediaWiki\Block\BlockTarget
 __toString ()
 
 equals (?BlockTarget $other)
 Compare this object with another one.
 
 getLegacyTuple ()
 Get the target and type tuple conventionally returned by BlockUtils::parseBlockTarget()
 
 getWikiId ()
 Get the ID of the wiki this page belongs to.
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 

Protected Member Functions

 getLegacyUnion ()
 Get the first part of the legacy tuple.
 
- Protected Member Functions inherited from MediaWiki\Block\BlockTarget
 __construct ( $wikiId)
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Block\BlockTarget
string false $wikiId
 

Detailed Description

A block target for a single IP address with an associated user page.

Since
1.44

Definition at line 18 of file AnonIpBlockTarget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\AnonIpBlockTarget::__construct ( string $addr,
$wikiId = WikiAwareEntity::LOCAL )
Parameters
string$addr
string | false$wikiId

Definition at line 25 of file AnonIpBlockTarget.php.

References MediaWiki\Block\BlockTarget\$wikiId.

Member Function Documentation

◆ getLegacyUnion()

MediaWiki\Block\AnonIpBlockTarget::getLegacyUnion ( )
protected

Get the first part of the legacy tuple.

Returns
UserIdentity|string

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 77 of file AnonIpBlockTarget.php.

◆ getLogPage()

MediaWiki\Block\AnonIpBlockTarget::getLogPage ( )

Get the title to be used when logging an action on this block.

For an autoblock, the title is technically invalid, with a hash character in the DB key. For a range block, the title is valid but is not a user page for a specific user.

See also getUserPage(), which exists only for subclasses which relate to a specific user with a talk page.

Returns
PageReference

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 42 of file AnonIpBlockTarget.php.

◆ getSpecificity()

MediaWiki\Block\AnonIpBlockTarget::getSpecificity ( )

Get the score of this block for purposes of choosing a more specific block, where lower is more specific.

  • 1: user block
  • 2: single IP block
  • 2-3: range block scaled according to the size of the range
Returns
float|int

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 38 of file AnonIpBlockTarget.php.

◆ getType()

MediaWiki\Block\AnonIpBlockTarget::getType ( )

Get one of the Block::TYPE_xxx constants associated with this target.

Returns
int

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 34 of file AnonIpBlockTarget.php.

◆ getUserIdentity()

MediaWiki\Block\AnonIpBlockTarget::getUserIdentity ( )

Get a UserIdentity associated with this target.

Returns
UserIdentity

Implements MediaWiki\Block\BlockTargetWithUserIdentity.

Definition at line 50 of file AnonIpBlockTarget.php.

◆ getUserPage()

MediaWiki\Block\AnonIpBlockTarget::getUserPage ( )

Get the target's user page.

The page has an associated talk page which can be used to talk to the target.

Returns
PageReference

Implements MediaWiki\Block\BlockTargetWithUserPage.

Definition at line 46 of file AnonIpBlockTarget.php.

◆ toHex()

MediaWiki\Block\AnonIpBlockTarget::toHex ( )

Get the IP address in hexadecimal form.

Returns
string

Definition at line 63 of file AnonIpBlockTarget.php.

◆ toHexRange()

MediaWiki\Block\AnonIpBlockTarget::toHexRange ( )

Get the IP address as a hex "range" tuple, with the start and end equal.

Returns
string[]

Implements MediaWiki\Block\BlockTargetWithIp.

Definition at line 72 of file AnonIpBlockTarget.php.

◆ toString()

MediaWiki\Block\AnonIpBlockTarget::toString ( )

Get the username, the IP address, range, or autoblock ID prefixed with a "#".

Such a string will round-trip through BlockTarget::newFromString(), giving back the same target.

Returns
string

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 30 of file AnonIpBlockTarget.php.

◆ validateForCreation()

MediaWiki\Block\AnonIpBlockTarget::validateForCreation ( )

Check the target data against more stringent requirements imposed when a block is created from user input.

This is in addition to the loose validation done by BlockTargetFactory::newFromString().

Returns
StatusValue

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 54 of file AnonIpBlockTarget.php.


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