jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/355805 )
Change subject: Show total number of autoblocks on top of Special:AutoblockList
......................................................................
Show total number of autoblocks on top of Special:AutoblockList
Bug: T163172
Change-Id: I51b1b7675c2f4ed68ccb725230ffecf3583cf65f
---
M includes/specials/SpecialAutoblockList.php
M includes/specials/pagers/BlockListPager.php
M languages/i18n/en.json
M languages/i18n/qqq.json
4 files changed, 37 insertions(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Kaldari: Looks good to me, approved
diff --git a/includes/specials/SpecialAutoblockList.php
b/includes/specials/SpecialAutoblockList.php
index dcb2444..bf13865 100644
--- a/includes/specials/SpecialAutoblockList.php
+++ b/includes/specials/SpecialAutoblockList.php
@@ -78,6 +78,7 @@
->prepareForm()
->displayForm( false );
+ $this->showTotal( $pager );
$this->showList( $pager );
}
@@ -98,6 +99,20 @@
}
/**
+ * 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
*/
diff --git a/includes/specials/pagers/BlockListPager.php
b/includes/specials/pagers/BlockListPager.php
index 9a447ef..51e446d 100644
--- a/includes/specials/pagers/BlockListPager.php
+++ b/includes/specials/pagers/BlockListPager.php
@@ -246,6 +246,26 @@
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';
}
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index cc60432..a0efd05 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2497,6 +2497,7 @@
"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",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 694ef74..7b7f27f 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2686,6 +2686,7 @@
"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}}",
--
To view, visit https://gerrit.wikimedia.org/r/355805
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I51b1b7675c2f4ed68ccb725230ffecf3583cf65f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MusikAnimal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits