From: Sam Reed Date: Tue, 25 May 2010 18:34:11 +0000 (+0000) Subject: Followup r66872 X-Git-Tag: 1.31.0-rc.0~36728 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=4aec2d838dcc80abd2a94563c412ee77c157561e;p=lhc%2Fweb%2Fwiklou.git Followup r66872 Use title to make interwiki --- diff --git a/includes/api/ApiQueryIWLinks.php b/includes/api/ApiQueryIWLinks.php index da664f3341..7d13f07494 100644 --- a/includes/api/ApiQueryIWLinks.php +++ b/includes/api/ApiQueryIWLinks.php @@ -55,13 +55,6 @@ class ApiQueryIWLinks extends ApiQueryBase { $this->addTables( 'iwlinks' ); $this->addWhereFld( 'iwl_from', array_keys( $this->getPageSet()->getGoodTitles() ) ); - $url = !is_null( $params['url'] ); - if ( $url ) { - $this->addTables( 'interwiki' ); - $this->addJoinConds( array( 'interwiki' => array( 'INNER JOIN', 'iw_prefix=iwl_prefix' ) ) ); - $this->addFields( 'iw_url' ); - } - if ( !is_null( $params['continue'] ) ) { $cont = explode( '|', $params['continue'] ); if ( count( $cont ) != 3 ) { @@ -100,9 +93,11 @@ class ApiQueryIWLinks extends ApiQueryBase { } $entry = array( 'prefix' => $row->iwl_prefix ); - if ( $url ) { - $rowUrl = str_replace( '$1', $row->iwl_title, $row->iw_url ); - $entry = array_merge( $entry, array( 'url' => $rowUrl ) ); + if ( !is_null( $params['url'] ) ) { + $title = Title::newFromText( "{$row->iwl_prefix}:{$row->iwl_title}" ); + if ( $title ) { + $entry = array_merge( $entry, array( 'url' => $title->getFullURL() ) ); + } } ApiResult::setContent( $entry, $row->iwl_title );