stylize api up to date
authorSam Reed <reedy@users.mediawiki.org>
Thu, 5 Aug 2010 07:02:09 +0000 (07:02 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 5 Aug 2010 07:02:09 +0000 (07:02 +0000)
includes/api/ApiBase.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiResult.php
includes/api/ApiUpload.php

index c53fd2f..9741a81 100644 (file)
@@ -307,7 +307,7 @@ abstract class ApiBase {
                                if ( $deprecated ) {
                                        $desc = "DEPRECATED! $desc";
                                }
-                               
+
                                $required = isset( $paramSettings[self::PARAM_REQUIRED] ) ?
                                        $paramSettings[self::PARAM_REQUIRED] : false;
                                if ( $required ) {
@@ -494,7 +494,7 @@ abstract class ApiBase {
 
                        if ( $params ) { // getFinalParams() can return false
                                foreach ( $params as $paramName => $paramSettings ) {
-                                       $results[$paramName] = $this->getParameterFromSettings( 
+                                       $results[$paramName] = $this->getParameterFromSettings(
                                                $paramName, $paramSettings, $parseLimit );
                                }
                        }
@@ -666,7 +666,7 @@ abstract class ApiBase {
                                                if ( $value === '' ) {
                                                        $this->dieUsageMsg( array( 'missingparam', $paramName ) );
                                                }
-                                       
+
                                                break;
                                        case 'integer': // Force everything using intval() and optionally validate limits
 
@@ -1129,7 +1129,7 @@ abstract class ApiBase {
                $params = $this->getFinalParams();
                if ( $params ) {
                        foreach ( $params as $paramName => $paramSettings ) {
-                               if( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) ) {
+                               if ( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) ) {
                                        $ret[] = array( 'missingparam', $paramName );
                                }
                        }
index eb401ca..aac8cc4 100644 (file)
@@ -262,7 +262,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        if ( $row->iw_local == '1' ) {
                                $val['local'] = '';
                        }
-                       //$val['trans'] = intval( $row->iw_trans ); // should this be exposed?
+                       // $val['trans'] = intval( $row->iw_trans ); // should this be exposed?
                        if ( isset( $langNames[$row->iw_prefix] ) ) {
                                $val['language'] = $langNames[$row->iw_prefix];
                        }
index 8c86c36..c4dae0e 100644 (file)
@@ -285,12 +285,12 @@ class ApiResult extends ApiBase {
                }
                return true;
        }
-       
+
        /**
         * Add a parsed limit=max to the result.
-        * 
+        *
         * @param $moduleName string
-        * @param $limit int 
+        * @param $limit int
         */
        public function setParsedLimit( $moduleName, $limit ) {
                // Add value, allowing overwriting
index 59a267d..73d5f2b 100644 (file)
@@ -56,10 +56,10 @@ class ApiUpload extends ApiBase {
                if ( !isset( $this->mUpload ) ) {
                        $this->dieUsage( 'No upload module set', 'nomodule' );
                }
-               
+
                // First check permission to upload
                $this->checkPermissions( $wgUser );
-               
+
                // Fetch the file
                $status = $this->mUpload->fetchFile();
                if ( !$status->isGood() ) {
@@ -70,7 +70,7 @@ class ApiUpload extends ApiBase {
 
                // Check if the uploaded file is sane
                $this->verifyUpload();
-               
+
                // Check permission to upload this file
                $permErrors = $this->mUpload->verifyPermissions( $wgUser );
                if ( $permErrors !== true ) {
@@ -91,13 +91,13 @@ class ApiUpload extends ApiBase {
                // Cleanup any temporary mess
                $this->mUpload->cleanupTempFile();
        }
-       
+
        /**
         * Select an upload module and set it to mUpload. Dies on failure.
         */
        protected function selectUploadModule() {
                $request = $this->getMain()->getRequest();
-               
+
                // One and only one of the following parameters is needed
                $this->requireOnlyOneParameter( $this->mParams,
                        'sessionkey', 'file', 'url' );
@@ -113,20 +113,20 @@ class ApiUpload extends ApiBase {
                        $this->mUpload->initialize( $this->mParams['filename'],
                                $this->mParams['sessionkey'],
                                $sessionData[$this->mParams['sessionkey']] );
-                       
-                       
+
+
                } elseif ( isset( $this->mParams['file'] ) ) {
                        $this->mUpload = new UploadFromFile();
                        $this->mUpload->initialize(
                                $this->mParams['filename'],
                                $request->getUpload( 'file' )
-                       );      
+                       );
                } elseif ( isset( $this->mParams['url'] ) ) {
                        // Make sure upload by URL is enabled:
                        if ( !UploadFromUrl::isEnabled() ) {
                                $this->dieUsageMsg( array( 'copyuploaddisabled' ) );
                        }
-                       
+
                        $async = false;
                        if ( $this->mParams['asyncdownload'] ) {
                                if ( $this->mParams['leavemessage'] ) {
@@ -166,7 +166,7 @@ class ApiUpload extends ApiBase {
        protected function verifyUpload( ) {
                $verification = $this->mUpload->verifyUpload( );
                if ( $verification['status'] === UploadBase::OK ) {
-                       return;         
+                       return;
                }
 
                // TODO: Move them to ApiBase's message map
@@ -212,7 +212,7 @@ class ApiUpload extends ApiBase {
        }
 
        /**
-        * Check warnings if ignorewarnings is not set. 
+        * Check warnings if ignorewarnings is not set.
         * Returns a suitable result array if there were warnings
         */
        protected function checkForWarnings() {
@@ -260,7 +260,7 @@ class ApiUpload extends ApiBase {
         */
        protected function performUpload() {
                global $wgUser;
-               
+
                // Use comment as initial page text by default
                if ( is_null( $this->mParams['text'] ) ) {
                        $this->mParams['text'] = $this->mParams['comment'];
@@ -280,7 +280,7 @@ class ApiUpload extends ApiBase {
 
                if ( !$status->isGood() ) {
                        $error = $status->getErrorsArray();
-                       
+
                        if ( count( $error ) == 1 && $error[0][0] == 'async' ) {
                                // The upload can not be performed right now, because the user
                                // requested so
@@ -341,12 +341,12 @@ class ApiUpload extends ApiBase {
 
                        'sessionkey' => null,
                );
-               
+
                global $wgAllowAsyncCopyUploads;
                if ( $wgAllowAsyncCopyUploads ) {
                        $params += array(
                                'asyncdownload' => false,
-                               'leavemessage' => false,                        
+                               'leavemessage' => false,
                        );
                }
                return $params;
@@ -370,12 +370,12 @@ class ApiUpload extends ApiBase {
                if ( $wgAllowAsyncCopyUploads ) {
                        $params += array(
                                'asyncdownload' => 'Make fetching a URL asynchronous',
-                               'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished',                        
+                               'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished',
                        );
                }
-               
+
                return $params;
-               
+
        }
 
        public function getDescription() {