}
}
- /** @var $row object */
+ /** @var object $row */
$row = $this->mCurrentRow;
$language = $this->getLanguage();
break;
case 'ipb_reason':
+ $value = CommentStore::getStore()->getComment( 'ipb_reason', $row )->text;
$formatted = Linker::formatComment( $value );
break;
}
function getQueryInfo() {
+ $commentQuery = CommentStore::getStore()->getJoin( 'ipb_reason' );
+
$info = [
- 'tables' => [ 'ipblocks', 'user' ],
+ 'tables' => [ 'ipblocks', 'user' ] + $commentQuery['tables'],
'fields' => [
'ipb_id',
'ipb_address',
'ipb_by',
'ipb_by_text',
'by_user_name' => 'user_name',
- 'ipb_reason',
'ipb_timestamp',
'ipb_auto',
'ipb_anon_only',
'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
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';
}