X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBase.php;h=84169cb843a866eb590d189a2a7dc63c4255a0f2;hb=ee56f00ddf0609082f8ae9a4dc3e6e1b6f54ddfd;hp=f8eaa840740f7df64aea213e07f5bc3766b930e6;hpb=68e16c26dd58afdf58a97f18f3cc76ed3b0ad9ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index f8eaa84074..84169cb843 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 @@ -97,9 +93,7 @@ abstract class ApiQueryBase extends ApiBase { return $this->mQueryModule; } - /** - * @see ApiBase::getParent() - */ + /** @inheritDoc */ public function getParent() { return $this->getQuery(); } @@ -121,7 +115,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 ) { @@ -261,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; } } @@ -456,10 +448,13 @@ abstract class ApiQueryBase extends ApiBase { 'ipb_id', 'ipb_by', 'ipb_by_text', - 'ipb_reason', 'ipb_expiry', 'ipb_timestamp' ] ); + $commentQuery = CommentStore::getStore()->getJoin( 'ipb_reason' ); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); } // Don't show hidden names @@ -478,7 +473,7 @@ abstract class ApiQueryBase extends ApiBase { /** * Add information (title and namespace) about a Title object to a * result array - * @param array $arr Result array à la ApiResult + * @param array &$arr Result array à la ApiResult * @param Title $title * @param string $prefix Module prefix */