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=9a447ef8f3742207df3b83cc0f1cbec26ff7110e;hb=12601ff7d2796752404bfb331fccc41083d31f9f;hpb=baa9036839396fb3b3a12bc06f52291b083a226d diff --git a/includes/specials/pagers/BlockListPager.php b/includes/specials/pagers/BlockListPager.php index 9a447ef8f3..51e446d593 100644 --- a/includes/specials/pagers/BlockListPager.php +++ b/includes/specials/pagers/BlockListPager.php @@ -246,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'; }