X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBase.php;h=3ad45bbbde5d9d9827d80f60a5eef2dd29163560;hp=6987dfb13fa9b2a91a19dc07f47b291ac373f571;hb=27c61fb1e94da9114314468fd00bcf129ec064b6;hpb=52ce204415df71eb978b1f6f61a6122f7c3b09f6 diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 6987dfb13f..3ad45bbbde 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -1,9 +1,5 @@ @gmail.com" * * This program is free software; you can redistribute it and/or modify @@ -259,12 +255,10 @@ abstract class ApiQueryBase extends ApiBase { /** * Equivalent to addWhere(array($field => $value)) * @param string $field Field name - * @param string|string[] $value Value; ignored if null or empty array; + * @param string|string[] $value Value; ignored if null or empty array */ protected function addWhereFld( $field, $value ) { - // Use count() to its full documented capabilities to simultaneously - // test for null, empty array or empty countable object - if ( count( $value ) ) { + if ( $value !== null && !( is_array( $value ) && !$value ) ) { $this->where[$field] = $value; } } @@ -452,12 +446,14 @@ abstract class ApiQueryBase extends ApiBase { if ( $showBlockInfo ) { $this->addFields( [ 'ipb_id', - 'ipb_by', - 'ipb_by_text', 'ipb_expiry', 'ipb_timestamp' ] ); - $commentQuery = CommentStore::newKey( 'ipb_reason' )->getJoin(); + $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'] );