MediaWiki master
MediaWiki\Block\RangeBlockTarget Class Reference

A block target for an IP address range. More...

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

Collaboration diagram for MediaWiki\Block\RangeBlockTarget:

Public Member Functions

 __construct (string $cidr, array $limits, $wikiId=WikiAwareEntity::LOCAL)
 
 getHexRangeEnd ()
 Get the end of the range in hexadecimal form.
 
 getHexRangeStart ()
 Get the start of the range in hexadecimal form.
 
 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.
 
 toHexRange ()
 Get the range as a hexadecimal tuple.
 
 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 an IP address range.

Since
1.44

Definition at line 16 of file RangeBlockTarget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\RangeBlockTarget::__construct ( string $cidr,
array $limits,
$wikiId = WikiAwareEntity::LOCAL )
Parameters
string$cidrThe range specification in CIDR notation
array$limitsThe minimum prefix lengths indexed by protocol (IPv4 or IPv6)
string | false$wikiIdThe wiki ID

Definition at line 29 of file RangeBlockTarget.php.

References MediaWiki\Block\BlockTarget\$wikiId.

Member Function Documentation

◆ getHexRangeEnd()

MediaWiki\Block\RangeBlockTarget::getHexRangeEnd ( )

Get the end of the range in hexadecimal form.

Returns
string

Definition at line 109 of file RangeBlockTarget.php.

Referenced by MediaWiki\Block\DatabaseBlock\getRangeEnd().

◆ getHexRangeStart()

MediaWiki\Block\RangeBlockTarget::getHexRangeStart ( )

Get the start of the range in hexadecimal form.

Returns
string

Definition at line 100 of file RangeBlockTarget.php.

Referenced by MediaWiki\Block\DatabaseBlock\getRangeStart().

◆ getLegacyUnion()

MediaWiki\Block\RangeBlockTarget::getLegacyUnion ( )
protected

Get the first part of the legacy tuple.

Returns
UserIdentity|string

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 113 of file RangeBlockTarget.php.

◆ getLogPage()

MediaWiki\Block\RangeBlockTarget::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 43 of file RangeBlockTarget.php.

◆ getSpecificity()

MediaWiki\Block\RangeBlockTarget::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 47 of file RangeBlockTarget.php.

◆ getType()

MediaWiki\Block\RangeBlockTarget::getType ( )

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

Returns
int

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 39 of file RangeBlockTarget.php.

◆ toHexRange()

MediaWiki\Block\RangeBlockTarget::toHexRange ( )

Get the range as a hexadecimal tuple.

Returns
string[]

Implements MediaWiki\Block\BlockTargetWithIp.

Definition at line 86 of file RangeBlockTarget.php.

◆ toString()

MediaWiki\Block\RangeBlockTarget::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 35 of file RangeBlockTarget.php.

◆ validateForCreation()

MediaWiki\Block\RangeBlockTarget::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 58 of file RangeBlockTarget.php.


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