MediaWiki REL1_31
SpecialAutoblockList.php
Go to the documentation of this file.
1<?php
31
32 function __construct() {
33 parent::__construct( 'AutoblockList' );
34 }
35
41 public function execute( $par ) {
42 $this->setHeaders();
43 $this->outputHeader();
44 $out = $this->getOutput();
45 $lang = $this->getLanguage();
46 $out->setPageTitle( $this->msg( 'autoblocklist' ) );
47 $this->addHelpLink( 'Autoblock' );
48 $out->addModuleStyles( [ 'mediawiki.special' ] );
49
50 # setup BlockListPager here to get the actual default Limit
51 $pager = $this->getBlockListPager();
52
53 # Just show the block list
54 $fields = [
55 'Limit' => [
56 'type' => 'limitselect',
57 'label-message' => 'table_pager_limit_label',
58 'options' => [
59 $lang->formatNum( 20 ) => 20,
60 $lang->formatNum( 50 ) => 50,
61 $lang->formatNum( 100 ) => 100,
62 $lang->formatNum( 250 ) => 250,
63 $lang->formatNum( 500 ) => 500,
64 ],
65 'name' => 'limit',
66 'default' => $pager->getLimit(),
67 ]
68 ];
69
70 $context = new DerivativeContext( $this->getContext() );
71 $context->setTitle( $this->getPageTitle() ); // Remove subpage
72 $form = HTMLForm::factory( 'ooui', $fields, $context );
73 $form->setMethod( 'get' )
74 ->setFormIdentifier( 'blocklist' )
75 ->setWrapperLegendMsg( 'autoblocklist-legend' )
76 ->setSubmitTextMsg( 'autoblocklist-submit' )
77 ->setSubmitProgressive()
78 ->prepareForm()
79 ->displayForm( false );
80
81 $this->showTotal( $pager );
82 $this->showList( $pager );
83 }
84
89 protected function getBlockListPager() {
90 $conds = [
91 'ipb_parent_block_id IS NOT NULL'
92 ];
93 # Is the user allowed to see hidden blocks?
94 if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
95 $conds['ipb_deleted'] = 0;
96 }
97
98 return new BlockListPager( $this, $conds );
99 }
100
106 protected function showTotal( BlockListPager $pager ) {
107 $out = $this->getOutput();
108 $out->addHTML(
109 Html::element( 'div', [ 'style' => 'font-weight: bold;' ],
110 $this->msg( 'autoblocklist-total-autoblocks', $pager->getTotalAutoblocks() )->parse() )
111 . "\n"
112 );
113 }
114
119 protected function showList( BlockListPager $pager ) {
120 $out = $this->getOutput();
121
122 # Check for other blocks, i.e. global/tor blocks
123 $otherAutoblockLink = [];
124 Hooks::run( 'OtherAutoblockLogLink', [ &$otherAutoblockLink ] );
125
126 # Show additional header for the local block only when other blocks exists.
127 # Not necessary in a standard installation without such extensions enabled
128 if ( count( $otherAutoblockLink ) ) {
129 $out->addHTML(
130 Html::element( 'h2', [], $this->msg( 'autoblocklist-localblocks',
131 $pager->getNumRows() )->parse() )
132 . "\n"
133 );
134 }
135
136 if ( $pager->getNumRows() ) {
137 $out->addParserOutputContent( $pager->getFullOutput() );
138 } else {
139 $out->addWikiMsg( 'autoblocklist-empty' );
140 }
141
142 if ( count( $otherAutoblockLink ) ) {
143 $out->addHTML(
144 Html::rawElement(
145 'h2',
146 [],
147 $this->msg( 'autoblocklist-otherblocks', count( $otherAutoblockLink ) )->parse()
148 ) . "\n"
149 );
150 $list = '';
151 foreach ( $otherAutoblockLink as $link ) {
152 $list .= Html::rawElement( 'li', [], $link ) . "\n";
153 }
154 $out->addHTML(
155 Html::rawElement(
156 'ul',
157 [ 'class' => 'mw-autoblocklist-otherblocks' ],
158 $list
159 ) . "\n"
160 );
161 }
162 }
163
164 protected function getGroupName() {
165 return 'users';
166 }
167}
getTotalAutoblocks()
Get total number of autoblocks at any given time.
An IContextSource implementation which will inherit context from another source but allow individual ...
getNumRows()
Get the number of rows in the result set.
A special page that lists autoblocks.
getBlockListPager()
Setup a new BlockListPager instance.
showList(BlockListPager $pager)
Show the list of blocked accounts matching the actual filter.
execute( $par)
Main execution point.
showTotal(BlockListPager $pager)
Show total number of autoblocks on top of the table.
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.
getUser()
Shortcut to get the User executing this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getFullOutput()
Get the formatted result list, with navigation bars.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2811
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:864
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition hooks.txt:3021
if(!isset( $args[0])) $lang