MediaWiki REL1_35
ApiQueryBlockInfoTrait.php
Go to the documentation of this file.
1<?php
24
30
38 private function addBlockInfoToQuery( $showBlockInfo ) {
39 $db = $this->getDB();
40
41 if ( $showBlockInfo ) {
42 $queryInfo = DatabaseBlock::getQueryInfo();
43 } else {
44 $queryInfo = [
45 'tables' => [ 'ipblocks' ],
46 'fields' => [ 'ipb_deleted' ],
47 'joins' => [],
48 ];
49 }
50
51 $this->addTables( [ 'blk' => $queryInfo['tables'] ] );
52 $this->addFields( $queryInfo['fields'] );
53 $this->addJoinConds( $queryInfo['joins'] );
54 $this->addJoinConds( [
55 'blk' => [ 'LEFT JOIN', [
56 'ipb_user=user_id',
57 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ),
58 ] ],
59 ] );
60
61 // Don't show hidden names
62 if ( !$this->getPermissionManager()->userHasRight( $this->getUser(), 'hideuser' ) ) {
63 $this->addWhere( 'ipb_deleted = 0 OR ipb_deleted IS NULL' );
64 }
65 }
66
76 abstract protected function getDB();
77
82 abstract protected function getPermissionManager(): PermissionManager;
83
88 abstract public function getUser();
89
95 abstract protected function addTables( $tables, $alias = null );
96
101 abstract protected function addFields( $fields );
102
107 abstract protected function addWhere( $conds );
108
113 abstract protected function addJoinConds( $conds );
114
117}
getPermissionManager()
getDB()
addJoinConds( $conds)
addBlockInfoToQuery( $showBlockInfo)
Filters hidden users (where the user doesn't have the right to view them) Also adds relevant block in...
addWhere( $conds)
addFields( $fields)
addTables( $tables, $alias=null)
getUser()
A DatabaseBlock (unlike a SystemBlock) is stored in the database, may give rise to autoblocks and may...
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
trait ApiBlockInfoTrait
trait ApiQueryBlockInfoTrait
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38