MediaWiki REL1_39
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->getAuthority()->isAllowed( 'hideuser' ) ) {
63 $this->addWhere( 'ipb_deleted = 0 OR ipb_deleted IS NULL' );
64 }
65 }
66
67 /***************************************************************************/
68 // region Methods required from ApiQueryBase
75 abstract protected function getDB();
76
81 abstract public function getAuthority();
82
88 abstract protected function addTables( $tables, $alias = null );
89
94 abstract protected function addFields( $fields );
95
100 abstract protected function addWhere( $conds );
101
106 abstract protected function addJoinConds( $conds );
107
108 // endregion -- end of methods required from ApiQueryBase
109
110}
getAuthority()
getDB()
addJoinConds( $conds)
addWhere( $conds)
addFields( $fields)
addTables( $tables, $alias=null)
A DatabaseBlock (unlike a SystemBlock) is stored in the database, may give rise to autoblocks and may...
trait ApiBlockInfoTrait
trait ApiQueryBlockInfoTrait
This interface represents the authority associated the current execution context, such as a web reque...
Definition Authority.php:37
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:39