MediaWiki  1.34.0
SystemBlock.php
Go to the documentation of this file.
1 <?php
23 namespace MediaWiki\Block;
24 
25 use IContextSource;
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 
78  $params = $this->getBlockErrorParams( $context );
79 
80  // TODO: Clean up error messages params so we don't have to do this (T227174)
81  $params[ 4 ] = $this->getSystemBlockType();
82 
83  $msg = 'systemblockedtext';
84 
85  array_unshift( $params, $msg );
86 
87  return $params;
88  }
89 
93  public function appliesToPasswordReset() {
94  switch ( $this->getSystemBlockType() ) {
95  case null:
96  case 'global-block':
97  return $this->isCreateAccountBlocked();
98  case 'proxy':
99  return true;
100  case 'dnsbl':
101  case 'wgSoftBlockRanges':
102  return false;
103  default:
104  return true;
105  }
106  }
107 
108 }
MediaWiki\Block
Definition: AbstractBlock.php:21
MediaWiki\Block\SystemBlock\$systemBlockType
string null $systemBlockType
Definition: SystemBlock.php:37
MediaWiki\Block\AbstractBlock\isCreateAccountBlocked
isCreateAccountBlocked( $x=null)
Get or set the flag indicating whether this block blocks the target from creating an account.
Definition: AbstractBlock.php:216
MediaWiki\Block\SystemBlock
System blocks are temporary blocks that are created on enforcement (e.g.
Definition: SystemBlock.php:35
MediaWiki\Block\AbstractBlock\getBlockErrorParams
getBlockErrorParams(IContextSource $context)
Get block information used in different block error messages.
Definition: AbstractBlock.php:534
MediaWiki\Block\SystemBlock\getSystemBlockType
getSystemBlockType()
Get the system block type, if any.
Definition: SystemBlock.php:70
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
MediaWiki\Block\SystemBlock\getPermissionsError
getPermissionsError(IContextSource $context)
Get the key and parameters for the corresponding error message.1.22 array
Definition: SystemBlock.php:77
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:93
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:34
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:38