MediaWiki master
MediaWiki\Block\AutoBlockTarget Class Reference

A block target of the form #1234 where the number is the block ID. More...

Inherits MediaWiki\Block\BlockTarget.

Collaboration diagram for MediaWiki\Block\AutoBlockTarget:

Public Member Functions

 __construct (int $id, $wikiId=WikiAwareEntity::LOCAL)
 
 getId ()
 Get the block ID.
 
 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.
 
 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 of the form #1234 where the number is the block ID.

For user input or display when the IP address needs to be hidden.

Since
1.44

Definition at line 16 of file AutoBlockTarget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\AutoBlockTarget::__construct ( int $id,
$wikiId = WikiAwareEntity::LOCAL )
Parameters
int$idThe block ID
string | false$wikiId

Definition at line 23 of file AutoBlockTarget.php.

References MediaWiki\Block\BlockTarget\$wikiId.

Member Function Documentation

◆ getId()

MediaWiki\Block\AutoBlockTarget::getId ( )

Get the block ID.

Returns
int

Definition at line 54 of file AutoBlockTarget.php.

◆ getLegacyUnion()

MediaWiki\Block\AutoBlockTarget::getLegacyUnion ( )
protected

Get the first part of the legacy tuple.

Returns
UserIdentity|string

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 58 of file AutoBlockTarget.php.

◆ getLogPage()

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

◆ getSpecificity()

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

◆ getType()

MediaWiki\Block\AutoBlockTarget::getType ( )

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

Returns
int

Reimplemented from MediaWiki\Block\BlockTarget.

Definition at line 32 of file AutoBlockTarget.php.

◆ toString()

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

◆ validateForCreation()

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


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