->prepareForm()
->displayForm( false );
+ $this->showTotal( $pager );
$this->showList( $pager );
}
return new BlockListPager( $this, $conds );
}
+ /**
+ * Show total number of autoblocks on top of the table
+ *
+ * @param BlockListPager $pager The BlockListPager instance for this page
+ */
+ protected function showTotal( BlockListPager $pager ) {
+ $out = $this->getOutput();
+ $out->addHTML(
+ Html::element( 'div', [ 'style' => 'font-weight: bold;' ],
+ $this->msg( 'autoblocklist-total-autoblocks', $pager->getTotalAutoblocks() )->parse() )
+ . "\n"
+ );
+ }
+
/**
* Show the list of blocked accounts matching the actual filter.
* @param BlockListPager $pager The BlockListPager instance for this page
return $info;
}
+ /**
+ * Get total number of autoblocks at any given time
+ *
+ * @return int Total number of unexpired active autoblocks
+ */
+ function getTotalAutoblocks() {
+ $dbr = $this->getDatabase();
+ $res = $dbr->selectField( 'ipblocks',
+ [ 'COUNT(*) AS totalautoblocks' ],
+ [
+ 'ipb_auto' => '1',
+ 'ipb_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ),
+ ]
+ );
+ if ( $res ) {
+ return $res;
+ }
+ return 0; // We found nothing
+ }
+
protected function getTableClass() {
return parent::getTableClass() . ' mw-blocklist';
}
"autoblocklist-submit": "Search",
"autoblocklist-legend": "List autoblocks",
"autoblocklist-localblocks": "Local {{PLURAL:$1|autoblock|autoblocks}}",
+ "autoblocklist-total-autoblocks": "Total number of autoblocks: $1",
"autoblocklist-empty": "The autoblock list is empty.",
"autoblocklist-otherblocks": "Other {{PLURAL:$1|autoblock|autoblocks}}",
"ipblocklist": "Blocked users",
"autoblocklist-legend": "Used as legend of the form in [[Special:AutoblockList]].\n\nSee also:\n* {{msg-mw|Autoblocklist-legend}}\n* {{msg-mw|Autoblocklist-submit}}",
"autoblocklist-localblocks": "[[File:Special AutoBlockList new.png|thumb|Example]]\nUsed on [[Special:AutoblockList]] as header when global autoblocks exists too.",
"autoblocklist-empty": "Used in [[Special:AutoblockList]].",
+ "autoblocklist-total-autoblocks": "Shows the total number of active autoblocks on [[Special:AutoblockList]]. Parameters:\n* $1 - number of autoblocks",
"autoblocklist-otherblocks": "[[File:Special AutoBlockList new.png|thumb|Example]]\nUsed on [[Special:AutoblockList]] as header for other blocks, i.e. from GlobalBlocking or TorBlocks.\n\nParameters:\n* $1 - number of blocks",
"ipblocklist": "Title of [[Special:Ipblocklist]].",
"ipblocklist-legend": "Used as legend of the form in [[Special:BlockList]].\n\nSee also:\n* {{msg-mw|Ipblocklist-legend}}\n* {{msg-mw|Ipblocklist-submit}}",