r69091 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69090‎ | r69091 | r69092 >
Date:13:15, 6 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Stylize API

Add a few braces
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryFilearchive.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryIWBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParse.php
@@ -452,7 +452,7 @@
453453 array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
454454 array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revisions' ),
455455 array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
456 - array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page'),
 456+ array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
457457 array( 'nosuchpageid' ),
458458 ) );
459459 }
Index: trunk/phase3/includes/api/ApiQueryFilearchive.php
@@ -147,13 +147,13 @@
148148 $file['height'] = $row->fa_height;
149149 $file['width'] = $row->fa_width;
150150 }
151 - if ( $fld_description ){
 151+ if ( $fld_description ) {
152152 $file['description'] = $row->fa_description;
153153 }
154 - if ( $fld_metadata ){
 154+ if ( $fld_metadata ) {
155155 $file['metadata'] = $row->fa_metadata ? ApiQueryImageInfo::processMetaData( unserialize( $row->fa_metadata ), $result ) : null;
156156 }
157 - if ( $fld_bitdepth ){
 157+ if ( $fld_bitdepth ) {
158158 $file['bitdepth'] = $row->fa_bits;
159159 }
160160 if ( $fld_mime ) {
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -299,6 +299,7 @@
300300
301301 case EditPage::AS_SUCCESS_NEW_ARTICLE:
302302 $r['new'] = '';
 303+
303304 case EditPage::AS_SUCCESS_UPDATE:
304305 $r['result'] = 'Success';
305306 $r['pageid'] = intval( $titleObj->getArticleID() );
@@ -326,7 +327,7 @@
327328 // This usually means some kind of race condition
328329 // or DB weirdness occurred.
329330 if ( is_array( $result ) && count( $result ) > 0 ) {
330 - $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) );
 331+ $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) );
331332 }
332333
333334 // Unknown error, but no specific error message
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -231,7 +231,7 @@
232232 $vals['pageid'] = intval( $row->page_id );
233233 }
234234
235 - if( $this->fld_title || $this->fld_parsedcomment ) {
 235+ if ( $this->fld_title || $this->fld_parsedcomment ) {
236236 $title = Title::makeTitle( $row->log_namespace, $row->log_title );
237237 }
238238
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -213,13 +213,13 @@
214214 if ( $mto && !$mto->isError() ) {
215215 $vals['thumburl'] = wfExpandUrl( $mto->getUrl() );
216216
217 - //bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted
218 - //thumbnail sizes for the thumbnail actual size
 217+ // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted
 218+ // thumbnail sizes for the thumbnail actual size
219219 if ( $mto->getUrl() !== $file->getUrl() ) {
220 - $vals['thumbwidth'] = intval( $mto->getWidth() );
 220+ $vals['thumbwidth'] = intval( $mto->getWidth() );
221221 $vals['thumbheight'] = intval( $mto->getHeight() );
222222 } else {
223 - $vals['thumbwidth'] = intval( $file->getWidth() );
 223+ $vals['thumbwidth'] = intval( $file->getWidth() );
224224 $vals['thumbheight'] = intval( $file->getHeight() );
225225 }
226226
Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
@@ -143,7 +143,7 @@
144144 }
145145
146146 public function getDescription() {
147 - return array('Find all pages that link to the given interwiki link.',
 147+ return array( 'Find all pages that link to the given interwiki link.',
148148 'Can be used to find all links with a prefix, or',
149149 'all links to a title (any prefix).',
150150 'Using neither parameter is effectively "All IW Links"',
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -258,8 +258,8 @@
259259 }
260260
261261 if ( $this->fld_notificationtimestamp ) {
262 - $vals['notificationtimestamp'] = ( $row->wl_notificationtimestamp == null )
263 - ? ''
 262+ $vals['notificationtimestamp'] = ( $row->wl_notificationtimestamp == null )
 263+ ? ''
264264 : wfTimestamp( TS_ISO_8601, $row->wl_notificationtimestamp );
265265 }
266266
Index: trunk/phase3/includes/api/ApiBase.php
@@ -317,12 +317,13 @@
318318 if ( is_array( $type ) ) {
319319 $choices = array();
320320 $nothingPrompt = false;
321 - foreach ( $type as $t )
 321+ foreach ( $type as $t ) {
322322 if ( $t === '' ) {
323323 $nothingPrompt = 'Can be empty, or ';
324324 } else {
325325 $choices[] = $t;
326326 }
 327+ }
327328 $desc .= $paramPrefix . $nothingPrompt . $prompt . implode( ', ', $choices );
328329 } else {
329330 switch ( $type ) {
@@ -711,8 +712,10 @@
712713 $value = wfTimestamp( TS_MW, $value );
713714 break;
714715 case 'user':
715 - if ( !is_array( $value ) ) $value = array( $value );
716 -
 716+ if ( !is_array( $value ) ) {
 717+ $value = array( $value );
 718+ }
 719+
717720 foreach ( $value as $key => $val ) {
718721 $title = Title::makeTitleSafe( NS_USER, $val );
719722 if ( is_null( $title ) ) {
@@ -721,9 +724,10 @@
722725 $value[$key] = $title->getText();
723726 }
724727
725 - if ( !$multi ) $value = $value[0];
726 -
727 - break;
 728+ if ( !$multi ) {
 729+ $value = $value[0];
 730+ }
 731+ break;
728732 default:
729733 ApiBase::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" );
730734 }
@@ -928,7 +932,7 @@
929933 'userrights-nodatabase' => array( 'code' => 'nosuchdatabase', 'info' => "Database ``\$1'' does not exist or is not local" ),
930934 'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
931935 'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
932 - 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required'),
 936+ 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required' ),
933937
934938 // API-specific messages
935939 'readrequired' => array( 'code' => 'readapidenied', 'info' => "You need read permission to use this module" ),
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -99,7 +99,7 @@
100100 $this->mParams['comment'],
101101 $this->mParams['watchlist'],
102102 $this->mParams['ignorewarnings'],
103 - $async);
 103+ $async );
104104
105105 $this->checkPermissions( $wgUser );
106106 if ( $async ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r70492Followup r69091 Where did those spaces come from? :/reedy07:08, 5 August 2010

Status & tagging log