if ( count( $ids ) ) {
$ids = $this->filterIDs( [ [ $table, $field ] ], $ids );
- if ( !count( $ids ) ) {
+ if ( $ids === [] ) {
// Return nothing, no IDs are valid
$this->where[] = '0 = 1';
} else {
public function showHiddenUsersAddBlockInfo( $showBlockInfo ) {
$db = $this->getDB();
- $this->addTables( 'ipblocks' );
- $this->addJoinConds( [
- 'ipblocks' => [ 'LEFT JOIN', [
+ $tables = [ 'ipblocks' ];
+ $fields = [ 'ipb_deleted' ];
+ $joinConds = [
+ 'blk' => [ 'LEFT JOIN', [
'ipb_user=user_id',
'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ),
] ],
- ] );
-
- $this->addFields( 'ipb_deleted' );
+ ];
if ( $showBlockInfo ) {
- $this->addFields( [
+ $actorQuery = ActorMigration::newMigration()->getJoin( 'ipb_by' );
+ $commentQuery = CommentStore::getStore()->getJoin( 'ipb_reason' );
+ $tables += $actorQuery['tables'] + $commentQuery['tables'];
+ $joinConds += $actorQuery['joins'] + $commentQuery['joins'];
+ $fields = array_merge( $fields, [
'ipb_id',
'ipb_expiry',
'ipb_timestamp'
- ] );
- $actorQuery = ActorMigration::newMigration()->getJoin( 'ipb_by' );
- $this->addTables( $actorQuery['tables'] );
- $this->addFields( $actorQuery['fields'] );
- $this->addJoinConds( $actorQuery['joins'] );
- $commentQuery = CommentStore::getStore()->getJoin( 'ipb_reason' );
- $this->addTables( $commentQuery['tables'] );
- $this->addFields( $commentQuery['fields'] );
- $this->addJoinConds( $commentQuery['joins'] );
+ ], $actorQuery['fields'], $commentQuery['fields'] );
}
+ $this->addTables( [ 'blk' => $tables ] );
+ $this->addFields( $fields );
+ $this->addJoinConds( $joinConds );
+
// Don't show hidden names
if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$this->addWhere( 'ipb_deleted = 0 OR ipb_deleted IS NULL' );
* @param string $prefix Module prefix
*/
public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
- $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
+ $arr[$prefix . 'ns'] = (int)$title->getNamespace();
$arr[$prefix . 'title'] = $title->getPrefixedText();
}
$result = $this->getResult();
ApiResult::setIndexedTagName( $data, $this->getModulePrefix() );
- return $result->addValue( [ 'query', 'pages', intval( $pageId ) ],
+ return $result->addValue( [ 'query', 'pages', (int)$pageId ],
$this->getModuleName(),
$data );
}