X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FBlockListPager.php;h=51e446d593091de7d9ea4515c306108e68747303;hp=a4124db5f4b2dbfb4314905d512a0e62345de146;hb=f7e1770fb832aa77bf4e16ce8cc815f2b24dd10d;hpb=e968a1f431ad058dcb14adb2757bde5664b99a79 diff --git a/includes/specials/pagers/BlockListPager.php b/includes/specials/pagers/BlockListPager.php index a4124db5f4..51e446d593 100644 --- a/includes/specials/pagers/BlockListPager.php +++ b/includes/specials/pagers/BlockListPager.php @@ -23,6 +23,7 @@ * @ingroup Pager */ use MediaWiki\MediaWikiServices; +use Wikimedia\Rdbms\ResultWrapper; class BlockListPager extends TablePager { @@ -245,6 +246,26 @@ class BlockListPager extends TablePager { 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'; }