MediaWiki  master
SystemBlock.php
Go to the documentation of this file.
1 <?php
23 namespace MediaWiki\Block;
24 
26 
35 class SystemBlock extends AbstractBlock {
38 
48  public function __construct( array $options = [] ) {
49  parent::__construct( $options );
50 
51  $defaults = [
52  'systemBlock' => null,
53  ];
54 
55  $options += $defaults;
56 
57  $this->systemBlockType = $options['systemBlock'];
58  }
59 
70  public function getSystemBlockType() {
72  }
73 
77  public function getIdentifier() {
78  return $this->getSystemBlockType();
79  }
80 
84  public function appliesToPasswordReset() {
85  switch ( $this->getSystemBlockType() ) {
86  case null:
87  case 'global-block':
88  return $this->isCreateAccountBlocked();
89  case 'proxy':
90  return true;
91  case 'dnsbl':
92  case 'wgSoftBlockRanges':
93  return false;
94  default:
95  return true;
96  }
97  }
98 
102  public function getBy() {
103  return 0;
104  }
105 
109  public function getByName() {
110  return '';
111  }
112 
116  public function getBlocker(): ?UserIdentity {
117  return null;
118  }
119 }
MediaWiki\Block
Definition: AbstractBlock.php:21
MediaWiki\Block\SystemBlock\$systemBlockType
string null $systemBlockType
Definition: SystemBlock.php:37
MediaWiki\Block\SystemBlock\getByName
getByName()
Get the username of the blocking sysop.string
Definition: SystemBlock.php:109
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:39
MediaWiki\Block\SystemBlock\getBy
getBy()
Get the user id of the blocking sysop.int (0 for foreign users)
Definition: SystemBlock.php:102
MediaWiki\Block\SystemBlock
System blocks are temporary blocks that are created on enforcement (e.g.
Definition: SystemBlock.php:35
MediaWiki\Block\SystemBlock\getSystemBlockType
getSystemBlockType()
Get the system block type, if any.
Definition: SystemBlock.php:70
MediaWiki\Block\SystemBlock\appliesToPasswordReset
appliesToPasswordReset()
Check if the block prevents a user from resetting their password.1.33 bool The block blocks password ...
Definition: SystemBlock.php:84
MediaWiki\Block\Block\isCreateAccountBlocked
isCreateAccountBlocked()
Get the flag indicating whether this block blocks the target from creating an account.
MediaWiki\Block\SystemBlock\getBlocker
getBlocker()
Get the user who applied this block.UserIdentity|null user identity or null. May be an external user.
Definition: SystemBlock.php:116
MediaWiki\Block\SystemBlock\__construct
__construct(array $options=[])
Create a new block with specified parameters on a user, IP or IP range.
Definition: SystemBlock.php:48
MediaWiki\Block\AbstractBlock
Definition: AbstractBlock.php:37
MediaWiki\Block\SystemBlock\getIdentifier
getIdentifier()
Get the information that identifies this block, such that a user could look up everything that can be...
Definition: SystemBlock.php:77