MediaWiki REL1_34
SystemBlock.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Block;
24
26
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}
isCreateAccountBlocked( $x=null)
Get or set the flag indicating whether this block blocks the target from creating an account.
getBlockErrorParams(IContextSource $context)
Get block information used in different block error messages.
System blocks are temporary blocks that are created on enforcement (e.g.
getSystemBlockType()
Get the system block type, if any.
__construct(array $options=[])
Create a new block with specified parameters on a user, IP or IP range.
getPermissionsError(IContextSource $context)
Get the key and parameters for the corresponding error message.1.22 array
appliesToPasswordReset()
Check if the block prevents a user from resetting their password.1.33 bool The block blocks password ...
Interface for objects which can provide a MediaWiki context on request.
$context
Definition load.php:45