From ddc7efbedfe44c5191f4426bb7ef7556bc1c17de Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 5 Aug 2010 07:02:09 +0000 Subject: [PATCH] stylize api up to date --- includes/api/ApiBase.php | 8 +++---- includes/api/ApiQuerySiteinfo.php | 2 +- includes/api/ApiResult.php | 6 +++--- includes/api/ApiUpload.php | 36 +++++++++++++++---------------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index c53fd2f166..9741a8145b 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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 ); } } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index eb401ca694..aac8cc4733 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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]; } diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 8c86c36af8..c4dae0e5fe 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -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 diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 59a267d22e..73d5f2b9bf 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -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() { -- 2.20.1