r70491 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70490‎ | r70491 | r70492 >
Date:07:02, 5 August 2010
Author:reedy
Status:ok
Tags:
Comment:
stylize api up to date
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiResult.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -262,7 +262,7 @@
263263 if ( $row->iw_local == '1' ) {
264264 $val['local'] = '';
265265 }
266 - //$val['trans'] = intval( $row->iw_trans ); // should this be exposed?
 266+ // $val['trans'] = intval( $row->iw_trans ); // should this be exposed?
267267 if ( isset( $langNames[$row->iw_prefix] ) ) {
268268 $val['language'] = $langNames[$row->iw_prefix];
269269 }
Index: trunk/phase3/includes/api/ApiResult.php
@@ -285,12 +285,12 @@
286286 }
287287 return true;
288288 }
289 -
 289+
290290 /**
291291 * Add a parsed limit=max to the result.
292 - *
 292+ *
293293 * @param $moduleName string
294 - * @param $limit int
 294+ * @param $limit int
295295 */
296296 public function setParsedLimit( $moduleName, $limit ) {
297297 // Add value, allowing overwriting
Index: trunk/phase3/includes/api/ApiBase.php
@@ -307,7 +307,7 @@
308308 if ( $deprecated ) {
309309 $desc = "DEPRECATED! $desc";
310310 }
311 -
 311+
312312 $required = isset( $paramSettings[self::PARAM_REQUIRED] ) ?
313313 $paramSettings[self::PARAM_REQUIRED] : false;
314314 if ( $required ) {
@@ -494,7 +494,7 @@
495495
496496 if ( $params ) { // getFinalParams() can return false
497497 foreach ( $params as $paramName => $paramSettings ) {
498 - $results[$paramName] = $this->getParameterFromSettings(
 498+ $results[$paramName] = $this->getParameterFromSettings(
499499 $paramName, $paramSettings, $parseLimit );
500500 }
501501 }
@@ -666,7 +666,7 @@
667667 if ( $value === '' ) {
668668 $this->dieUsageMsg( array( 'missingparam', $paramName ) );
669669 }
670 -
 670+
671671 break;
672672 case 'integer': // Force everything using intval() and optionally validate limits
673673
@@ -1129,7 +1129,7 @@
11301130 $params = $this->getFinalParams();
11311131 if ( $params ) {
11321132 foreach ( $params as $paramName => $paramSettings ) {
1133 - if( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) ) {
 1133+ if ( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) ) {
11341134 $ret[] = array( 'missingparam', $paramName );
11351135 }
11361136 }
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -56,10 +56,10 @@
5757 if ( !isset( $this->mUpload ) ) {
5858 $this->dieUsage( 'No upload module set', 'nomodule' );
5959 }
60 -
 60+
6161 // First check permission to upload
6262 $this->checkPermissions( $wgUser );
63 -
 63+
6464 // Fetch the file
6565 $status = $this->mUpload->fetchFile();
6666 if ( !$status->isGood() ) {
@@ -70,7 +70,7 @@
7171
7272 // Check if the uploaded file is sane
7373 $this->verifyUpload();
74 -
 74+
7575 // Check permission to upload this file
7676 $permErrors = $this->mUpload->verifyPermissions( $wgUser );
7777 if ( $permErrors !== true ) {
@@ -91,13 +91,13 @@
9292 // Cleanup any temporary mess
9393 $this->mUpload->cleanupTempFile();
9494 }
95 -
 95+
9696 /**
9797 * Select an upload module and set it to mUpload. Dies on failure.
9898 */
9999 protected function selectUploadModule() {
100100 $request = $this->getMain()->getRequest();
101 -
 101+
102102 // One and only one of the following parameters is needed
103103 $this->requireOnlyOneParameter( $this->mParams,
104104 'sessionkey', 'file', 'url' );
@@ -113,20 +113,20 @@
114114 $this->mUpload->initialize( $this->mParams['filename'],
115115 $this->mParams['sessionkey'],
116116 $sessionData[$this->mParams['sessionkey']] );
117 -
118 -
 117+
 118+
119119 } elseif ( isset( $this->mParams['file'] ) ) {
120120 $this->mUpload = new UploadFromFile();
121121 $this->mUpload->initialize(
122122 $this->mParams['filename'],
123123 $request->getUpload( 'file' )
124 - );
 124+ );
125125 } elseif ( isset( $this->mParams['url'] ) ) {
126126 // Make sure upload by URL is enabled:
127127 if ( !UploadFromUrl::isEnabled() ) {
128128 $this->dieUsageMsg( array( 'copyuploaddisabled' ) );
129129 }
130 -
 130+
131131 $async = false;
132132 if ( $this->mParams['asyncdownload'] ) {
133133 if ( $this->mParams['leavemessage'] ) {
@@ -166,7 +166,7 @@
167167 protected function verifyUpload( ) {
168168 $verification = $this->mUpload->verifyUpload( );
169169 if ( $verification['status'] === UploadBase::OK ) {
170 - return;
 170+ return;
171171 }
172172
173173 // TODO: Move them to ApiBase's message map
@@ -212,7 +212,7 @@
213213 }
214214
215215 /**
216 - * Check warnings if ignorewarnings is not set.
 216+ * Check warnings if ignorewarnings is not set.
217217 * Returns a suitable result array if there were warnings
218218 */
219219 protected function checkForWarnings() {
@@ -260,7 +260,7 @@
261261 */
262262 protected function performUpload() {
263263 global $wgUser;
264 -
 264+
265265 // Use comment as initial page text by default
266266 if ( is_null( $this->mParams['text'] ) ) {
267267 $this->mParams['text'] = $this->mParams['comment'];
@@ -280,7 +280,7 @@
281281
282282 if ( !$status->isGood() ) {
283283 $error = $status->getErrorsArray();
284 -
 284+
285285 if ( count( $error ) == 1 && $error[0][0] == 'async' ) {
286286 // The upload can not be performed right now, because the user
287287 // requested so
@@ -341,12 +341,12 @@
342342
343343 'sessionkey' => null,
344344 );
345 -
 345+
346346 global $wgAllowAsyncCopyUploads;
347347 if ( $wgAllowAsyncCopyUploads ) {
348348 $params += array(
349349 'asyncdownload' => false,
350 - 'leavemessage' => false,
 350+ 'leavemessage' => false,
351351 );
352352 }
353353 return $params;
@@ -370,12 +370,12 @@
371371 if ( $wgAllowAsyncCopyUploads ) {
372372 $params += array(
373373 'asyncdownload' => 'Make fetching a URL asynchronous',
374 - 'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished',
 374+ 'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished',
375375 );
376376 }
377 -
 377+
378378 return $params;
379 -
 379+
380380 }
381381
382382 public function getDescription() {

Status & tagging log