r76195 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76194‎ | r76195 | r76196 >
Date:15:57, 6 November 2010
Author:btongminh
Status:ok
Tags:
Comment:
Follow up r75621: Use setContent and setIndexedTagName methods
Modified paths:
  • /trunk/phase3/includes/api/ApiRsd.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiRsd.php
@@ -45,15 +45,9 @@
4646 $result->addValue( null, 'version', '1.0' );
4747 $result->addValue( null, 'xmlns', 'http://archipelago.phrasewise.com/rsd' );
4848
49 - $service = array(
50 - 'engineName' => array(
51 - '*' => 'MediaWiki'
52 - ),
53 - 'engineLink' => array(
54 - '*' => 'http://www.mediawiki.org/'
55 - ),
56 - 'apis' => $this->formatRsdApiList()
57 - );
 49+ $service = array( 'apis' => $this->formatRsdApiList() );
 50+ ApiResult::setContent( $service, 'MediaWiki', 'engineName' );
 51+ ApiResult::setContent( $service, 'http://www.mediawiki.org/', 'engineLink' );
5852
5953 $result->setIndexedTagName( $service['apis'], 'api' );
6054
@@ -138,12 +132,11 @@
139133 'name' => $name,
140134 'preferred' => wfBoolToStr( $name == 'MediaWiki' ),
141135 'apiLink' => $info['apiLink'],
142 - 'blogID' => isset( $info['blogID'] ) ? $info['blogID'] : ''
 136+ 'blogID' => isset( $info['blogID'] ) ? $info['blogID'] : '',
143137 );
 138+ $settings = array();
144139 if ( isset( $info['docs'] ) ) {
145 - $data['settings']['docs'] = array(
146 - '*' => $info['docs'],
147 - );
 140+ ApiResult::setContent( $settings, $info['docs'], 'docs' );
148141 }
149142 if ( isset( $info['settings'] ) ) {
150143 foreach ( $info['settings'] as $setting => $val ) {
@@ -152,14 +145,14 @@
153146 } else {
154147 $xmlVal = $val;
155148 }
156 - $data['settings'][] = array(
157 - 'name' => $setting,
158 - '*' => $xmlVal,
159 - );
 149+ $setting = array( 'name' => $setting );
 150+ ApiResult::setContent( $setting, $xmlVal );
 151+ $settings[] = $setting;
160152 }
161153 }
162 - if ( isset( $data['settings'] ) ) {
163 - $data['settings']['_element'] = 'setting';
 154+ if ( count( $settings ) ) {
 155+ $this->getResult()->setIndexedTagName( $settings, 'setting' );
 156+ $data['settings'] = $settings;
164157 }
165158 $outputData[] = $data;
166159 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75621(bug 25648) API discovery information has been added as RSD link in page <hea...btongminh19:20, 28 October 2010

Status & tagging log