Index: trunk/phase3/includes/api/ApiQueryIWLinks.php |
— | — | @@ -55,13 +55,6 @@ |
56 | 56 | $this->addTables( 'iwlinks' ); |
57 | 57 | $this->addWhereFld( 'iwl_from', array_keys( $this->getPageSet()->getGoodTitles() ) ); |
58 | 58 | |
59 | | - $url = !is_null( $params['url'] ); |
60 | | - if ( $url ) { |
61 | | - $this->addTables( 'interwiki' ); |
62 | | - $this->addJoinConds( array( 'interwiki' => array( 'INNER JOIN', 'iw_prefix=iwl_prefix' ) ) ); |
63 | | - $this->addFields( 'iw_url' ); |
64 | | - } |
65 | | - |
66 | 59 | if ( !is_null( $params['continue'] ) ) { |
67 | 60 | $cont = explode( '|', $params['continue'] ); |
68 | 61 | if ( count( $cont ) != 3 ) { |
— | — | @@ -100,9 +93,11 @@ |
101 | 94 | } |
102 | 95 | $entry = array( 'prefix' => $row->iwl_prefix ); |
103 | 96 | |
104 | | - if ( $url ) { |
105 | | - $rowUrl = str_replace( '$1', $row->iwl_title, $row->iw_url ); |
106 | | - $entry = array_merge( $entry, array( 'url' => $rowUrl ) ); |
| 97 | + if ( !is_null( $params['url'] ) ) { |
| 98 | + $title = Title::newFromText( "{$row->iwl_prefix}:{$row->iwl_title}" ); |
| 99 | + if ( $title ) { |
| 100 | + $entry = array_merge( $entry, array( 'url' => $title->getFullURL() ) ); |
| 101 | + } |
107 | 102 | } |
108 | 103 | |
109 | 104 | ApiResult::setContent( $entry, $row->iwl_title ); |