The light at the end of the API code format updating tunnel
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 14 Nov 2013 13:01:41 +0000 (14:01 +0100)
committerChad <chadh@wikimedia.org>
Thu, 14 Nov 2013 18:29:19 +0000 (18:29 +0000)
Change-Id: I12fdb71bc87a8ad5ed5b9f1fe9c06bd0f7154e9a

includes/api/ApiResult.php
includes/api/ApiRsd.php
includes/api/ApiSetNotificationTimestamp.php
includes/api/ApiTokens.php
includes/api/ApiUnblock.php
includes/api/ApiUpload.php
includes/api/ApiUserrights.php

index 39c114b..68137ff 100644 (file)
@@ -117,6 +117,7 @@ class ApiResult extends ApiBase {
                        // Objects can't always be cast to string
                        $s = strlen( $value );
                }
+
                return $s;
        }
 
@@ -287,7 +288,8 @@ class ApiResult extends ApiBase {
                        if ( $newsize > $wgAPIMaxResultSize ) {
                                $this->setWarning(
                                        "This result was truncated because it would otherwise be larger than the " .
-                                                       "limit of {$wgAPIMaxResultSize} bytes" );
+                                               "limit of {$wgAPIMaxResultSize} bytes" );
+
                                return false;
                        }
                        $this->mSize = $newsize;
@@ -322,6 +324,7 @@ class ApiResult extends ApiBase {
                        // Add named element
                        self::setElement( $data, $name, $value, $flags );
                }
+
                return true;
        }
 
@@ -394,6 +397,7 @@ class ApiResult extends ApiBase {
                        $result[] = $error;
                }
                $this->setIndexedTagName( $result, $errorType );
+
                return $result;
        }
 
index d219c91..e01f0fa 100644 (file)
@@ -107,6 +107,7 @@ class ApiRsd extends ApiBase {
                        ),
                );
                wfRunHooks( 'ApiRsdServiceApis', array( &$apis ) );
+
                return $apis;
        }
 
@@ -149,6 +150,7 @@ class ApiRsd extends ApiBase {
                        }
                        $outputData[] = $data;
                }
+
                return $outputData;
        }
 }
index 53a68fd..5302896 100644 (file)
@@ -172,6 +172,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                if ( !isset( $this->mPageSet ) ) {
                        $this->mPageSet = new ApiPageSet( $this );
                }
+
                return $this->mPageSet;
        }
 
@@ -210,8 +211,8 @@ class ApiSetNotificationTimestamp extends ApiBase {
                if ( $flags ) {
                        $result += $this->getPageSet()->getFinalParams( $flags );
                }
-               return $result;
 
+               return $result;
        }
 
        public function getParamDescription() {
@@ -271,6 +272,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
        public function getPossibleErrors() {
                $ps = $this->getPageSet();
+
                return array_merge(
                        parent::getPossibleErrors(),
                        $ps->getFinalPossibleErrors(),
index d220a5e..6862668 100644 (file)
@@ -67,6 +67,7 @@ class ApiTokens extends ApiBase {
                wfRunHooks( 'ApiTokensGetTokenTypes', array( &$types ) );
                ksort( $types );
                wfProfileOut( __METHOD__ );
+
                return $types;
        }
 
index 6a739a2..78137a8 100644 (file)
@@ -96,6 +96,7 @@ class ApiUnblock extends ApiBase {
 
        public function getParamDescription() {
                $p = $this->getModulePrefix();
+
                return array(
                        'id' => "ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with {$p}user",
                        'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
index 5839edc..6d5861d 100644 (file)
@@ -141,6 +141,7 @@ class ApiUpload extends ApiBase {
                        // Stash the file and get stash result
                        return $this->getStashResult( $warnings );
                }
+
                // This is the most common case -- a normal upload with no warnings
                // performUpload will return a formatted properly for the API with status
                return $this->performUpload( $warnings );
@@ -165,6 +166,7 @@ class ApiUpload extends ApiBase {
                } catch ( MWException $e ) {
                        $this->dieUsage( $e->getMessage(), 'stashfailed' );
                }
+
                return $result;
        }
 
@@ -185,6 +187,7 @@ class ApiUpload extends ApiBase {
                } catch ( MWException $e ) {
                        $result['warnings']['stashfailed'] = $e->getMessage();
                }
+
                return $result;
        }
 
@@ -217,6 +220,7 @@ class ApiUpload extends ApiBase {
                                $chunkPath, $chunkSize, $this->mParams['offset'] );
                        if ( !$status->isGood() ) {
                                $this->dieUsage( $status->getWikiText(), 'stashfailed' );
+
                                return array();
                        }
                }
@@ -252,6 +256,7 @@ class ApiUpload extends ApiBase {
                                $status = $this->mUpload->concatenateChunks();
                                if ( !$status->isGood() ) {
                                        $this->dieUsage( $status->getWikiText(), 'stashfailed' );
+
                                        return array();
                                }
 
@@ -265,6 +270,7 @@ class ApiUpload extends ApiBase {
                }
                $result['filekey'] = $filekey;
                $result['offset'] = $this->mParams['offset'] + $chunkSize;
+
                return $result;
        }
 
@@ -287,6 +293,7 @@ class ApiUpload extends ApiBase {
                        wfDebug( __METHOD__ . ' ' . $message . "\n" );
                        throw new MWException( $message );
                }
+
                return $fileKey;
        }
 
@@ -341,6 +348,7 @@ class ApiUpload extends ApiBase {
                        }
                        unset( $progress['status'] ); // remove Status object
                        $this->getResult()->addValue( null, $this->getModuleName(), $progress );
+
                        return false;
                }
 
@@ -357,6 +365,7 @@ class ApiUpload extends ApiBase {
                                $sessionData['sessionkey'] = $this->mParams['statuskey'];
                        }
                        $this->getResult()->addValue( null, $this->getModuleName(), $sessionData );
+
                        return false;
                }
 
@@ -481,7 +490,7 @@ class ApiUpload extends ApiBase {
                                break;
                        case UploadBase::ILLEGAL_FILENAME:
                                $this->dieRecoverableError( 'illegal-filename', 'filename',
-                                               array( 'filename' => $verification['filtered'] ) );
+                                       array( 'filename' => $verification['filtered'] ) );
                                break;
                        case UploadBase::FILENAME_TOO_LONG:
                                $this->dieRecoverableError( 'filename-toolong', 'filename' );
@@ -521,15 +530,15 @@ class ApiUpload extends ApiBase {
                        case UploadBase::VERIFICATION_ERROR:
                                $this->getResult()->setIndexedTagName( $verification['details'], 'detail' );
                                $this->dieUsage( 'This file did not pass file verification', 'verification-error',
-                                               0, array( 'details' => $verification['details'] ) );
+                                       0, array( 'details' => $verification['details'] ) );
                                break;
                        case UploadBase::HOOK_ABORTED:
                                $this->dieUsage( "The modification you tried to make was aborted by an extension hook",
-                                               'hookaborted', 0, array( 'error' => $verification['error'] ) );
+                                       'hookaborted', 0, array( 'error' => $verification['error'] ) );
                                break;
                        default:
                                $this->dieUsage( 'An unknown error occurred', 'unknown-error',
-                                               0, array( 'code' => $verification['status'] ) );
+                                       0, array( 'code' => $verification['status'] ) );
                                break;
                }
        }
@@ -569,6 +578,7 @@ class ApiUpload extends ApiBase {
                                $warnings[$warning['warning']] = $localFile->getName();
                        }
                }
+
                return $warnings;
        }
 
@@ -764,7 +774,6 @@ class ApiUpload extends ApiBase {
                );
 
                return $params;
-
        }
 
        public function getResultProperties() {
index 7d30828..5e068cb 100644 (file)
@@ -72,6 +72,7 @@ class ApiUserrights extends ApiBase {
                }
 
                $this->mUser = $user;
+
                return $user;
        }