*/
protected function addTables( $tables, $alias = null ) {
if ( is_array( $tables ) ) {
- if ( !is_null( $alias ) ) {
+ if ( $alias !== null ) {
ApiBase::dieDebug( __METHOD__, 'Multiple table aliases not supported' );
}
$this->tables = array_merge( $this->tables, $tables );
+ } elseif ( $alias !== null ) {
+ $this->tables[$alias] = $tables;
} else {
- if ( !is_null( $alias ) ) {
- $this->tables[$alias] = $tables;
- } else {
- $this->tables[] = $tables;
- }
+ $this->tables[] = $tables;
}
}
return Hooks::run( 'ApiQueryBaseProcessRow', [ $this, $row, &$data, &$hookData ] );
}
- /**
- * @deprecated since 1.33, use LinkFilter::getQueryConditions() instead
- * @param string|null $query
- * @param string|null $protocol
- * @return null|string
- */
- public function prepareUrlQuerySearchString( $query = null, $protocol = null ) {
- wfDeprecated( __METHOD__, '1.33' );
- $db = $this->getDB();
- if ( $query !== null && $query !== '' ) {
- if ( is_null( $protocol ) ) {
- $protocol = 'http://';
- }
-
- $likeQuery = LinkFilter::makeLikeArray( $query, $protocol );
- if ( !$likeQuery ) {
- $this->dieWithError( 'apierror-badquery' );
- }
-
- $likeQuery = LinkFilter::keepOneWildcard( $likeQuery );
-
- return 'el_index ' . $db->buildLike( $likeQuery );
- } elseif ( !is_null( $protocol ) ) {
- return 'el_index ' . $db->buildLike( "$protocol", $db->anyString() );
- }
-
- return null;
- }
-
/**
* Filters hidden users (where the user doesn't have the right to view them)
* Also adds relevant block information
/**
* Same as addPageSubItems(), but one element of $data at a time
* @param int $pageId Page ID
- * @param array $item Data array à la ApiResult
+ * @param mixed $item Data à la ApiResult
* @param string|null $elemname XML element name. If null, getModuleName()
* is used
* @return bool Whether the element fit in the result