45 private function addBlockInfoToQuery( $showBlockInfo ) {
49 if ( $showBlockInfo ) {
50 $queryInfo = DatabaseBlock::getQueryInfo();
53 'tables' => [
'ipblocks' ],
54 'fields' => [
'ipb_deleted' ],
59 $this->
addTables( [
'blk' => $queryInfo[
'tables'] ] );
63 'blk' => [
'LEFT JOIN', [
65 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ),
71 $this->
addWhere( [
'ipb_deleted' => [ 0,
null ] ] );
82 private function addDeletedUserFilter() {
84 $utils = MediaWikiServices::getInstance()->getHideUserUtils();
86 $this->
addWhere( $utils->getExpression( $this->getDB() ) );
88 $this->
addFields( [
'hu_deleted' =>
'1=0' ] );
91 'hu_deleted' => $utils->getExpression(
94 HideUserUtils::HIDDEN_USERS
110 private function getBlockDetailsForRows( $rows ) {
112 foreach ( $rows as $row ) {
113 $ids[] = (int)$row->user_id;
118 $blocks = MediaWikiServices::getInstance()->getDatabaseBlockStore()
119 ->newListFromConds( [
'bt_user' => $ids ] );
121 foreach ( $blocks as $block ) {
122 $blocksByUser[$block->getTargetUserIdentity()->getId()][] = $block;
125 foreach ( $blocksByUser as $id => $userBlocks ) {
126 if ( count( $userBlocks ) > 1 ) {
127 $maybeCompositeBlock = CompositeBlock::createFromBlocks( ...$userBlocks );
129 $maybeCompositeBlock = $userBlocks[0];
131 $infoByUser[$id] = $this->getBlockDetails( $maybeCompositeBlock );
144 abstract protected function getDB();
157 abstract protected function addTables( $tables, $alias =
null );
addTables( $tables, $alias=null)
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
trait ApiQueryBlockInfoTrait