Fix trailing whitespace
authorSam Reed <reedy@users.mediawiki.org>
Wed, 29 Jun 2011 23:46:39 +0000 (23:46 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 29 Jun 2011 23:46:39 +0000 (23:46 +0000)
Swap methods that call $this->getResult() to use temporary variable

includes/SiteStats.php
includes/api/ApiBase.php
includes/api/ApiQuery.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiResult.php
includes/api/ApiUpload.php
includes/api/ApiUserrights.php

index 9041757..d61d4fc 100644 (file)
@@ -377,7 +377,7 @@ class SiteStatsInit {
                $this->mPages = $this->db->selectField( 'page', 'COUNT(*)', '', __METHOD__ );
                return $this->mPages;
        }
-       
+
        /**
         * Count total users
         * @return Integer
@@ -386,7 +386,7 @@ class SiteStatsInit {
                $this->mUsers = $this->db->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
                return $this->mUsers;
        }
-       
+
        /**
         * Count views
         * @return Integer
index 3884428..c10aeed 100644 (file)
@@ -181,7 +181,8 @@ abstract class ApiBase {
         * @param $warning string Warning message
         */
        public function setWarning( $warning ) {
-               $data = $this->getResult()->getData();
+               $result = $this->getResult();
+               $data = $result->getData();
                if ( isset( $data['warnings'][$this->getModuleName()] ) ) {
                        // Don't add duplicate warnings
                        $warn_regex = preg_quote( $warning, '/' );
@@ -191,13 +192,13 @@ abstract class ApiBase {
                        $oldwarning = $data['warnings'][$this->getModuleName()]['*'];
                        // If there is a warning already, append it to the existing one
                        $warning = "$oldwarning\n$warning";
-                       $this->getResult()->unsetValue( 'warnings', $this->getModuleName() );
+                       $result->unsetValue( 'warnings', $this->getModuleName() );
                }
                $msg = array();
                ApiResult::setContent( $msg, $warning );
-               $this->getResult()->disableSizeCheck();
-               $this->getResult()->addValue( 'warnings', $this->getModuleName(), $msg );
-               $this->getResult()->enableSizeCheck();
+               $result->disableSizeCheck();
+               $result->addValue( 'warnings', $this->getModuleName(), $msg );
+               $result->enableSizeCheck();
        }
 
        /**
index fedc847..844b66e 100644 (file)
@@ -601,8 +601,6 @@ class ApiQuery extends ApiBase {
         * @return string
         */
        public function makeHelpMsg() {
-               $msg = '';
-
                // Make sure the internal object is empty
                // (just in case a sub-module decides to optimize during instantiation)
                $this->mPageSet = null;
@@ -610,7 +608,7 @@ class ApiQuery extends ApiBase {
 
                $querySeparator = str_repeat( '--- ', 12 );
                $moduleSeparator = str_repeat( '*** ', 14 );
-               $msg .= "\n$querySeparator Query: Prop  $querySeparator\n\n";
+               $msg = "\n$querySeparator Query: Prop  $querySeparator\n\n";
                $msg .= $this->makeHelpMsgHelper( $this->mQueryPropModules, 'prop' );
                $msg .= "\n$querySeparator Query: List  $querySeparator\n\n";
                $msg .= $this->makeHelpMsgHelper( $this->mQueryListModules, 'list' );
index e051c83..913dbdd 100644 (file)
@@ -172,6 +172,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
 
                $count = 0;
                $res = $this->select( __METHOD__ );
+               $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that there are additional pages to be had. Stop here...
@@ -183,13 +184,13 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        if ( !$vals ) {
                                continue;
                        }
-                       $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ), null, $vals );
+                       $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
                        if ( !$fit ) {
                                $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );
                                break;
                        }
                }
-               $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
+               $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
        }
 
        /**
index 5100973..a8ca604 100644 (file)
@@ -346,7 +346,6 @@ class ApiResult extends ApiBase {
                global $wgContLang;
                $s = $wgContLang->normalize( $s );
        }
-       
 
        /**
         * Converts a Status object to an array suitable for addValue
@@ -358,7 +357,7 @@ class ApiResult extends ApiBase {
                if ( $status->isGood() ) {
                        return array();
                }
-               
+
                $result = array();
                foreach ( $status->getErrorsByType( $errorType ) as $error ) {
                        $this->setIndexedTagName( $error['params'], 'param' );
index c123bac..8b302e4 100644 (file)
@@ -146,11 +146,11 @@ class ApiUpload extends ApiBase {
                }
                return $sessionKey;
        }
-       
+
        /**
-        * Throw an error that the user can recover from by providing a better 
+        * Throw an error that the user can recover from by providing a better
         * value for $parameter
-        * 
+        *
         * @param $error array Error array suitable for passing to dieUsageMsg()
         * @param $parameter string Parameter that needs revising
         * @param $data array Optional extra data to pass to the user
@@ -163,7 +163,7 @@ class ApiUpload extends ApiBase {
                        $data['stashfailed'] = $e->getMessage();
                }
                $data['invalidparameter'] = $parameter;
-               
+
                $parsed = $this->parseMsg( $error );
                $this->dieUsage( $parsed['info'], $parsed['code'], 0, $data );
        }
@@ -184,7 +184,7 @@ class ApiUpload extends ApiBase {
 
                if ( $this->mParams['statuskey'] ) {
                        $this->checkAsyncDownloadEnabled();
-                       
+
                        // Status request for an async upload
                        $sessionData = UploadFromUrlJob::getSessionData( $this->mParams['statuskey'] );
                        if ( !isset( $sessionData['result'] ) ) {
@@ -231,7 +231,7 @@ class ApiUpload extends ApiBase {
                        $async = false;
                        if ( $this->mParams['asyncdownload'] ) {
                                $this->checkAsyncDownloadEnabled();
-                               
+
                                if ( $this->mParams['leavemessage'] && !$this->mParams['ignorewarnings'] ) {
                                        $this->dieUsage( 'Using leavemessage without ignorewarnings is not supported',
                                                'missing-ignorewarnings' );
@@ -286,7 +286,7 @@ class ApiUpload extends ApiBase {
                        // Recoverable errors
                        case UploadBase::MIN_LENGTH_PARTNAME:
                                $this->dieRecoverableError( 'filename-tooshort', 'filename' );
-                               break;                  
+                               break;
                        case UploadBase::ILLEGAL_FILENAME:
                                $this->dieRecoverableError( 'illegal-filename', 'filename',
                                                array( 'filename' => $verification['filtered'] ) );
@@ -297,7 +297,7 @@ class ApiUpload extends ApiBase {
                        case UploadBase::WINDOWS_NONASCII_FILENAME:
                                $this->dieRecoverableError( 'windows-nonascii-filename', 'filename' );
                                break;
-                       
+
                        // Unrecoverable errors
                        case UploadBase::EMPTY_FILE:
                                $this->dieUsage( 'The file you submitted was empty', 'empty-file' );
@@ -345,18 +345,19 @@ class ApiUpload extends ApiBase {
                }
                return $this->transformWarnings( $warnings );
        }
-                       
+
        protected function transformWarnings( $warnings ) {
                if ( $warnings ) {
                        // Add indices
-                       $this->getResult()->setIndexedTagName( $warnings, 'warning' );
+                       $result = $this->getResult();
+                       $result->setIndexedTagName( $warnings, 'warning' );
 
                        if ( isset( $warnings['duplicate'] ) ) {
                                $dupes = array();
                                foreach ( $warnings['duplicate'] as $dupe ) {
                                        $dupes[] = $dupe->getName();
                                }
-                               $this->getResult()->setIndexedTagName( $dupes, 'duplicate' );
+                               $result->setIndexedTagName( $dupes, 'duplicate' );
                                $warnings['duplicate'] = $dupes;
                        }
 
@@ -418,7 +419,7 @@ class ApiUpload extends ApiBase {
 
                return $result;
        }
-       
+
        /**
         * Checks if asynchronous copy uploads are enabled and throws an error if they are not.
         */
index f0aeebf..60853a1 100644 (file)
@@ -53,9 +53,10 @@ class ApiUserrights extends ApiBase {
                                $user, (array)$params['add'],
                                (array)$params['remove'], $params['reason'] );
 
-               $this->getResult()->setIndexedTagName( $r['added'], 'group' );
-               $this->getResult()->setIndexedTagName( $r['removed'], 'group' );
-               $this->getResult()->addValue( null, $this->getModuleName(), $r );
+               $result = $this->getResult();
+               $result->setIndexedTagName( $r['added'], 'group' );
+               $result->setIndexedTagName( $r['removed'], 'group' );
+               $result->addValue( null, $this->getModuleName(), $r );
        }
 
        /**