71 parent::__construct(
'BlockList' );
89 $out->setPageTitle( $this->
msg(
'ipblocklist' ) );
90 $out->addModuleStyles( [
'mediawiki.special' ] );
93 $par = $request->getVal(
'ip', $par ??
'' );
94 $this->target = trim( $request->getVal(
'wpTarget', $par ) );
96 $this->options = $request->getArray(
'wpOptions', [] );
97 $this->blockType = $request->getVal(
'blockType' );
99 $action = $request->getText(
'action' );
101 if ( $action ==
'unblock' || $action ==
'submit' && $request->wasPosted() ) {
102 # B/C @since 1.18: Unblock interface is now at Special:Unblock
104 $out->redirect(
$title->getFullURL() );
109 # setup BlockListPager here to get the actual default Limit
112 # Just show the block list
116 'label-message' =>
'ipaddressorusername',
122 'type' =>
'multiselect',
123 'options-messages' => [
124 'blocklist-tempblocks' =>
'tempblocks',
125 'blocklist-indefblocks' =>
'indefblocks',
126 'blocklist-autoblocks' =>
'autoblocks',
127 'blocklist-userblocks' =>
'userblocks',
128 'blocklist-addressblocks' =>
'addressblocks',
129 'blocklist-rangeblocks' =>
'rangeblocks',
135 $fields[
'BlockType'] = [
137 'label-message' =>
'blocklist-type',
139 $this->
msg(
'blocklist-type-opt-all' )->escaped() =>
'',
140 $this->
msg(
'blocklist-type-opt-sitewide' )->escaped() =>
'sitewide',
141 $this->
msg(
'blocklist-type-opt-partial' )->escaped() =>
'partial',
143 'name' =>
'blockType',
144 'cssclass' =>
'mw-field-block-type',
148 'type' =>
'limitselect',
149 'label-message' =>
'table_pager_limit_label',
150 'options' => $pager->getLimitSelectList(),
152 'default' => $pager->getLimit(),
153 'cssclass' =>
'mw-field-limit mw-has-field-block-type',
158 $form = HTMLForm::factory(
'ooui', $fields, $context );
161 ->setFormIdentifier(
'blocklist' )
162 ->setWrapperLegendMsg(
'ipblocklist-legend' )
163 ->setSubmitTextMsg(
'ipblocklist-submit' )
165 ->displayForm(
false );
176 $db = $this->
getDB();
177 # Is the user allowed to see hidden blocks?
178 if ( !$this->
getAuthority()->isAllowed(
'hideuser' ) ) {
179 $conds[
'ipb_deleted'] = 0;
182 if ( $this->target !==
'' ) {
183 list(
$target,
$type ) = $this->blockUtils->parseBlockTarget( $this->target );
186 case DatabaseBlock::TYPE_ID:
187 case DatabaseBlock::TYPE_AUTO:
191 case DatabaseBlock::TYPE_IP:
192 case DatabaseBlock::TYPE_RANGE:
193 list( $start, $end ) = IPUtils::parseRange(
$target );
194 $conds[] = $db->makeList(
197 DatabaseBlock::getRangeCond( $start, $end )
201 $conds[
'ipb_auto'] = 0;
204 case DatabaseBlock::TYPE_USER:
205 $conds[
'ipb_address'] =
$target->getName();
206 $conds[
'ipb_auto'] = 0;
212 if ( in_array(
'userblocks', $this->options ) ) {
213 $conds[
'ipb_user'] = 0;
215 if ( in_array(
'autoblocks', $this->options ) ) {
217 $conds[] =
"ipb_parent_block_id IS NULL OR ipb_parent_block_id = 0";
219 if ( in_array(
'addressblocks', $this->options ) ) {
220 $conds[] =
"ipb_user != 0 OR ipb_range_end > ipb_range_start";
222 if ( in_array(
'rangeblocks', $this->options ) ) {
223 $conds[] =
"ipb_range_end = ipb_range_start";
226 $hideTemp = in_array(
'tempblocks', $this->options );
227 $hideIndef = in_array(
'indefblocks', $this->options );
228 if ( $hideTemp && $hideIndef ) {
231 } elseif ( $hideTemp ) {
232 $conds[
'ipb_expiry'] = $db->getInfinity();
233 } elseif ( $hideIndef ) {
234 $conds[] =
"ipb_expiry != " . $db->addQuotes( $db->getInfinity() );
237 if ( $this->blockType ===
'sitewide' ) {
238 $conds[
'ipb_sitewide'] = 1;
239 } elseif ( $this->blockType ===
'partial' ) {
240 $conds[
'ipb_sitewide'] = 0;
246 $this->linkBatchFactory,
247 $this->blockRestrictionStore,
252 $this->blockActionInfo
263 # Check for other blocks, i.e. global/tor blocks
264 $otherBlockLink = [];
265 $this->
getHookRunner()->onOtherBlockLogLink( $otherBlockLink, $this->target );
267 # Show additional header for the local block only when other blocks exists.
268 # Not necessary in a standard installation without such extensions enabled
269 if ( count( $otherBlockLink ) ) {
271 Html::element(
'h2', [], $this->
msg(
'ipblocklist-localblock' )->text() ) .
"\n"
277 } elseif ( $this->target ) {
278 $out->addWikiMsg(
'ipblocklist-no-results' );
280 $out->addWikiMsg(
'ipblocklist-empty' );
283 if ( count( $otherBlockLink ) ) {
288 $this->
msg(
'ipblocklist-otherblocks', count( $otherBlockLink ) )->parse()
292 foreach ( $otherBlockLink as $link ) {
293 $list .= Html::rawElement(
'li', [], $link ) .
"\n";
295 $out->addHTML( Html::rawElement(
297 [
'class' =>
'mw-ipblocklist-otherblocks' ],
313 return $this->loadBalancer->getConnectionRef( ILoadBalancer::DB_REPLICA );
An IContextSource implementation which will inherit context from another source but allow individual ...
A special page that lists existing blocks.
BlockActionInfo $blockActionInfo
BlockRestrictionStore $blockRestrictionStore
getDB()
Return a IDatabase object for reading.
ILoadBalancer $loadBalancer
LinkBatchFactory $linkBatchFactory
__construct(LinkBatchFactory $linkBatchFactory, BlockRestrictionStore $blockRestrictionStore, ILoadBalancer $loadBalancer, CommentStore $commentStore, BlockUtils $blockUtils, BlockActionInfo $blockActionInfo)
showList(BlockListPager $pager)
Show the list of blocked accounts matching the actual filter.
CommentStore $commentStore
getBlockListPager()
Setup a new BlockListPager instance.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getAuthority()
Shortcut to get the Authority executing this instance.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.