r89539 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89538‎ | r89539 | r89540 >
Date:22:51, 5 June 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
* (bug 29237) add interwiki target url attribute to api/query/interwiki
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -101,6 +101,7 @@
102102 * (bug 28002) Internal error in ApiFormatRaw::getMimeType
103103 * (bug 26597) Allow toggling of persistent cookies ("remember me") in API
104104 action=login
 105+* (bug 29237) add interwiki target url attribute to api/query/interwiki
105106
106107 === Languages updated in 1.19 ===
107108
Index: trunk/phase3/includes/api/ApiQuery.php
@@ -49,7 +49,7 @@
5050 */
5151 private $mPageSet;
5252
53 - private $params, $redirects, $convertTitles;
 53+ private $params, $redirects, $convertTitles, $iwUrl;
5454
5555 private $mQueryPropModules = array(
5656 'info' => 'ApiQueryInfo',
@@ -232,6 +232,7 @@
233233 $this->params = $this->extractRequestParams();
234234 $this->redirects = $this->params['redirects'];
235235 $this->convertTitles = $this->params['converttitles'];
 236+ $this->iwUrl = $this->params['wurl'];
236237
237238 // Create PageSet
238239 $this->mPageSet = new ApiPageSet( $this, $this->redirects, $this->convertTitles );
@@ -367,10 +368,15 @@
368369 // Interwiki titles
369370 $intrwValues = array();
370371 foreach ( $pageSet->getInterwikiTitles() as $rawTitleStr => $interwikiStr ) {
371 - $intrwValues[] = array(
 372+ $item = array(
372373 'title' => $rawTitleStr,
373 - 'iw' => $interwikiStr
 374+ 'iw' => $interwikiStr,
374375 );
 376+ if ( $this->iwUrl ) {
 377+ $title = Title::newFromText( "{$interwikiStr}:{$rawTitleStr}" );
 378+ $item['url'] = $title->getFullURL();
 379+ }
 380+ $intrwValues[] = $item;
375381 }
376382
377383 if ( count( $intrwValues ) ) {
@@ -586,6 +592,7 @@
587593 'indexpageids' => false,
588594 'export' => false,
589595 'exportnowrap' => false,
 596+ 'iwurl' => false,
590597 );
591598 }
592599
@@ -672,6 +679,7 @@
673680 'indexpageids' => 'Include an additional pageids section listing all returned page IDs',
674681 'export' => 'Export the current revisions of all given or generated pages',
675682 'exportnowrap' => 'Return the export XML without wrapping it in an XML result (same format as Special:Export). Can only be used with export',
 683+ 'iwurl' => 'Whether to get the full URL if the title is an interwiki link',
676684 );
677685 }
678686

Follow-up revisions

RevisionCommit summaryAuthorDate
r89541Fix typo from r89539reedy23:28, 5 June 2011
r90273Followup r89539, per CR, we don't need to append iw string as it already exis...reedy15:24, 17 June 2011

Comments

#Comment by Duplicatebug (talk | contribs)   11:56, 14 June 2011

This produce wrong output for url, because $rawTitleStr contains the interwiki prefix already.

Status & tagging log