X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBase.php;h=fe16134c7b40166c9fb716fd189141550f4017a8;hb=1a40e0cc86b6ee0706606ded3ea243dfde4a414c;hp=44526e88b1e43d7ea7af8f54c7d8a458eb09e00a;hpb=5256bb8ce2da1390f84ef535d990129eebd74fd2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 44526e88b1..179e6f7b25 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -97,9 +97,7 @@ abstract class ApiQueryBase extends ApiBase { return $this->mQueryModule; } - /** - * @see ApiBase::getParent() - */ + /** @inheritDoc */ public function getParent() { return $this->getQuery(); } @@ -121,7 +119,7 @@ abstract class ApiQueryBase extends ApiBase { * See ApiQuery::getNamedDB() for more information * @param string $name Name to assign to the database connection * @param int $db One of the DB_* constants - * @param array $groups Query groups + * @param string|string[] $groups Query groups * @return IDatabase */ public function selectNamedDB( $name, $db, $groups ) { @@ -264,9 +262,7 @@ abstract class ApiQueryBase extends ApiBase { * @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; } } @@ -456,10 +452,13 @@ abstract class ApiQueryBase extends ApiBase { 'ipb_id', 'ipb_by', 'ipb_by_text', - 'ipb_reason', 'ipb_expiry', 'ipb_timestamp' ] ); + $commentQuery = CommentStore::newKey( 'ipb_reason' )->getJoin(); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); } // Don't show hidden names