X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FBlockListPager.php;h=924fd06cf069aa3c72e6df59c74fed38a3416633;hp=a4124db5f4b2dbfb4314905d512a0e62345de146;hb=2480aae0c97d822e10b50619e7b48b25c45af073;hpb=41f1ce0d35b929d480ce87605a3234c187e44fd2 diff --git a/includes/specials/pagers/BlockListPager.php b/includes/specials/pagers/BlockListPager.php index a4124db5f4..924fd06cf0 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 { @@ -78,7 +79,7 @@ class BlockListPager extends TablePager { } } - /** @var $row object */ + /** @var object $row */ $row = $this->mCurrentRow; $language = $this->getLanguage(); @@ -172,6 +173,7 @@ class BlockListPager extends TablePager { break; case 'ipb_reason': + $value = CommentStore::newKey( 'ipb_reason' )->getComment( $row )->text; $formatted = Linker::formatComment( $value ); break; @@ -207,8 +209,10 @@ class BlockListPager extends TablePager { } function getQueryInfo() { + $commentQuery = CommentStore::newKey( 'ipb_reason' )->getJoin(); + $info = [ - 'tables' => [ 'ipblocks', 'user' ], + 'tables' => [ 'ipblocks', 'user' ] + $commentQuery['tables'], 'fields' => [ 'ipb_id', 'ipb_address', @@ -216,7 +220,6 @@ class BlockListPager extends TablePager { 'ipb_by', 'ipb_by_text', 'by_user_name' => 'user_name', - 'ipb_reason', 'ipb_timestamp', 'ipb_auto', 'ipb_anon_only', @@ -228,9 +231,9 @@ class BlockListPager extends TablePager { 'ipb_deleted', 'ipb_block_email', 'ipb_allow_usertalk', - ], + ] + $commentQuery['fields'], 'conds' => $this->conds, - 'join_conds' => [ 'user' => [ 'LEFT JOIN', 'user_id = ipb_by' ] ] + 'join_conds' => [ 'user' => [ 'LEFT JOIN', 'user_id = ipb_by' ] ] + $commentQuery['joins'] ]; # Filter out any expired blocks @@ -245,6 +248,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'; }