Fixed spacing in api folder
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 19 Apr 2013 18:03:05 +0000 (20:03 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 20 Apr 2013 07:47:36 +0000 (07:47 +0000)
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Id7779dca4d1185245cf5764102b8de8b232c34b6

29 files changed:
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiComparePages.php
includes/api/ApiCreateAccount.php
includes/api/ApiFeedContributions.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiImageRotate.php
includes/api/ApiImport.php
includes/api/ApiMain.php
includes/api/ApiMove.php
includes/api/ApiPurge.php
includes/api/ApiQueryAllMessages.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiUpload.php

index 08fde7a..ee5aa97 100644 (file)
@@ -311,8 +311,7 @@ abstract class ApiBase extends ContextSource {
                                        );
                                }
                                $msg .= "Example" . ( count( $examples ) > 1 ? 's' : '' ) . ":\n";
-                               foreach( $examples as $k => $v ) {
-
+                               foreach ( $examples as $k => $v ) {
                                        if ( is_numeric( $k ) ) {
                                                $msg .= "  $v\n";
                                        } else {
@@ -1397,7 +1396,7 @@ abstract class ApiBase extends ContextSource {
        public function dieUsageMsg( $error ) {
                # most of the time we send a 1 element, so we might as well send it as
                # a string and make this an array here.
-               if( is_string( $error ) ) {
+               if ( is_string( $error ) ) {
                        $error = array( $error );
                }
                $parsed = $this->parseMsg( $error );
@@ -1412,10 +1411,10 @@ abstract class ApiBase extends ContextSource {
         */
        public function dieUsageMsgOrDebug( $error ) {
                global $wgDebugAPI;
-               if( $wgDebugAPI !== true ) {
+               if ( $wgDebugAPI !== true ) {
                        $this->dieUsageMsg( $error );
                } else {
-                       if( is_string( $error ) ) {
+                       if ( is_string( $error ) ) {
                                $error = array( $error );
                        }
                        $parsed = $this->parseMsg( $error );
@@ -1448,7 +1447,7 @@ abstract class ApiBase extends ContextSource {
 
                // Check whether the error array was nested
                // array( array( <code>, <params> ), array( <another_code>, <params> ) )
-               if( is_array( $key ) ) {
+               if ( is_array( $key ) ) {
                        $error = $key;
                        $key = array_shift( $error );
                }
index 90432b9..ab0a7e9 100644 (file)
@@ -104,7 +104,7 @@ class ApiBlock extends ApiBase {
                $res['userID'] = $target instanceof User ? $target->getId() : 0;
 
                $block = Block::newFromTarget( $target );
-               if( $block instanceof Block ) {
+               if ( $block instanceof Block ) {
                        $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity()
                                ? 'infinite'
                                : wfTimestamp( TS_ISO_8601, $block->mExpiry );
index 79ffcb0..1e35c34 100644 (file)
@@ -81,17 +81,17 @@ class ApiComparePages extends ApiBase {
         * @return int
         */
        private function revisionOrTitleOrId( $revision, $titleText, $titleId ) {
-               if( $revision ) {
+               if ( $revision ) {
                        return $revision;
-               } elseif( $titleText ) {
+               } elseif ( $titleText ) {
                        $title = Title::newFromText( $titleText );
-                       if( !$title || $title->isExternal() ) {
+                       if ( !$title || $title->isExternal() ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $titleText ) );
                        }
                        return $title->getLatestRevID();
                } elseif ( $titleId ) {
                        $title = Title::newFromID( $titleId );
-                       if( !$title ) {
+                       if ( !$title ) {
                                $this->dieUsageMsg( array( 'nosuchpageid', $titleId ) );
                        }
                        return $title->getLatestRevID();
index 278ea29..59ff324 100644 (file)
@@ -48,7 +48,7 @@ class ApiCreateAccount extends ApiBase {
                        wfSetupSession();
                }
 
-               if( $params['mailpassword'] && !$params['email'] ) {
+               if ( $params['mailpassword'] && !$params['email'] ) {
                        $this->dieUsageMsg( 'noemail' );
                }
 
@@ -80,20 +80,20 @@ class ApiCreateAccount extends ApiBase {
 
                $status = $loginForm->addNewaccountInternal();
                $result = array();
-               if( $status->isGood() ) {
+               if ( $status->isGood() ) {
                        // Success!
                        global $wgEmailAuthentication;
                        $user = $status->getValue();
 
-                       if( $params['language'] ) {
+                       if ( $params['language'] ) {
                                $user->setOption( 'language', $params['language'] );
                        }
 
-                       if( $params['mailpassword'] ) {
+                       if ( $params['mailpassword'] ) {
                                // If mailpassword was set, disable the password and send an email.
                                $user->setPassword( null );
                                $status->merge( $loginForm->mailPasswordInternal( $user, false, 'createaccount-title', 'createaccount-text' ) );
-                       } elseif( $wgEmailAuthentication && Sanitizer::validateEmail( $user->getEmail() ) ) {
+                       } elseif ( $wgEmailAuthentication && Sanitizer::validateEmail( $user->getEmail() ) ) {
                                // Send out an email authentication message if needed
                                $status->merge( $user->sendConfirmationMail() );
                        }
@@ -120,18 +120,18 @@ class ApiCreateAccount extends ApiBase {
 
                $apiResult = $this->getResult();
 
-               if( $status->hasMessage( 'sessionfailure' ) || $status->hasMessage( 'nocookiesfornew' ) ) {
+               if ( $status->hasMessage( 'sessionfailure' ) || $status->hasMessage( 'nocookiesfornew' ) ) {
                        // Token was incorrect, so add it to result, but don't throw an exception
                        // since not having the correct token is part of the normal
                        // flow of events.
                        $result['token'] = LoginForm::getCreateaccountToken();
                        $result['result'] = 'needtoken';
-               } elseif( !$status->isOK() ) {
+               } elseif ( !$status->isOK() ) {
                        // There was an error. Die now.
                        // Cannot use dieUsageMsg() directly because extensions
                        // might return custom error messages.
                        $errors = $status->getErrorsArray();
-                       if( $errors[0] instanceof Message ) {
+                       if ( $errors[0] instanceof Message ) {
                                $code = 'aborted';
                                $desc = $errors[0];
                        } else {
@@ -139,14 +139,14 @@ class ApiCreateAccount extends ApiBase {
                                $desc = wfMessage( $code, $errors[0] );
                        }
                        $this->dieUsage( $desc, $code );
-               } elseif( !$status->isGood() ) {
+               } elseif ( !$status->isGood() ) {
                        // Status is not good, but OK. This means warnings.
                        $result['result'] = 'warning';
 
                        // Add any warnings to the result
                        $warnings = $status->getErrorsByType( 'warning' );
-                       if( $warnings ) {
-                               foreach( $warnings as &$warning ) {
+                       if ( $warnings ) {
+                               foreach ( $warnings as &$warning ) {
                                        $apiResult->setIndexedTagName( $warning['params'], 'param' );
                                }
                                $apiResult->setIndexedTagName( $warnings, 'warning' );
@@ -259,7 +259,7 @@ class ApiCreateAccount extends ApiBase {
 
                $errors = parent::getPossibleErrors();
                // All local errors are from LoginForm, which means they're actually message keys.
-               foreach( $localErrors as $error ) {
+               foreach ( $localErrors as $error ) {
                        $errors[] = array( 'code' => $error, 'info' => wfMessage( $error )->parse() );
                }
 
index 42fb652..a11563b 100644 (file)
@@ -43,11 +43,11 @@ class ApiFeedContributions extends ApiBase {
 
                global $wgFeed, $wgFeedClasses, $wgSitename, $wgLanguageCode;
 
-               if( !$wgFeed ) {
+               if ( !$wgFeed ) {
                        $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                }
 
-               if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
+               if ( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                        $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                }
 
@@ -82,7 +82,7 @@ class ApiFeedContributions extends ApiBase {
                ) );
 
                $feedItems = array();
-               if( $pager->getNumRows() > 0 ) {
+               if ( $pager->getNumRows() > 0 ) {
                        foreach ( $pager->mResult as $row ) {
                                $feedItems[] = $this->feedItem( $row );
                        }
@@ -93,7 +93,7 @@ class ApiFeedContributions extends ApiBase {
 
        protected function feedItem( $row ) {
                $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
-               if( $title ) {
+               if ( $title ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
                        $revision = Revision::newFromRow( $row );
@@ -124,7 +124,7 @@ class ApiFeedContributions extends ApiBase {
         * @return string
         */
        protected function feedItemDesc( $revision ) {
-               if( $revision ) {
+               if ( $revision ) {
                        $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text();
                        $content = $revision->getContent();
 
index b96ea37..ddcd6ac 100644 (file)
@@ -56,11 +56,11 @@ class ApiFeedWatchlist extends ApiBase {
                try {
                        $params = $this->extractRequestParams();
 
-                       if( !$wgFeed ) {
+                       if ( !$wgFeed ) {
                                $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                        }
 
-                       if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
+                       if ( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                                $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                        }
 
index 3ecb0d5..7a60e83 100644 (file)
@@ -37,15 +37,15 @@ class ApiImageRotate extends ApiBase {
         */
        private static function addValues( array &$result, $values, $flag = null, $name = null ) {
                foreach ( $values as $val ) {
-                       if( $val instanceof Title ) {
+                       if ( $val instanceof Title ) {
                                $v = array();
                                ApiQueryBase::addTitleInfo( $v, $val );
-                       } elseif( $name !== null ) {
+                       } elseif ( $name !== null ) {
                                $v = array( $name => $val );
                        } else {
                                $v = $val;
                        }
-                       if( $flag !== null ) {
+                       if ( $flag !== null ) {
                                $v[$flag] = '';
                        }
                        $result[] = $v;
index 1f0a5fa..56af76f 100644 (file)
@@ -66,7 +66,7 @@ class ApiImport extends ApiBase {
                }
                if ( isset( $params['rootpage'] ) ) {
                        $statusRootPage = $importer->setTargetRootPage( $params['rootpage'] );
-                       if( !$statusRootPage->isGood() ) {
+                       if ( !$statusRootPage->isGood() ) {
                                $this->dieUsageMsg( $statusRootPage->getErrorsArray() );
                        }
                }
index 76f9b42..99847cf 100644 (file)
@@ -788,7 +788,7 @@ class ApiMain extends ApiBase {
 
                // Allow extensions to stop execution for arbitrary reasons.
                $message = false;
-               if( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
+               if ( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
                        $this->dieUsageMsg( $message );
                }
        }
@@ -950,7 +950,7 @@ class ApiMain extends ApiBase {
                        $unusedParams = array_diff( $allParams, $paramsUsed );
                }
 
-               if( count( $unusedParams ) ) {
+               if ( count( $unusedParams ) ) {
                        $s = count( $unusedParams ) > 1 ? 's' : '';
                        $this->setWarning( "Unrecognized parameter$s: '" . implode( $unusedParams, "', '" ) . "'" );
                }
@@ -963,7 +963,7 @@ class ApiMain extends ApiBase {
         */
        protected function printResult( $isError ) {
                global $wgDebugAPI;
-               if( $wgDebugAPI !== false ) {
+               if ( $wgDebugAPI !== false ) {
                        $this->setWarning( 'SECURITY WARNING: $wgDebugAPI is enabled' );
                }
 
@@ -1008,7 +1008,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 'help',
                                ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'action' )
                        ),
-                       'maxlag'  => array(
+                       'maxlag' => array(
                                ApiBase::PARAM_TYPE => 'integer'
                        ),
                        'smaxage' => array(
@@ -1020,7 +1020,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 0
                        ),
                        'requestid' => null,
-                       'servedby'  => false,
+                       'servedby' => false,
                        'origin' => null,
                );
        }
index 3e846e3..c18036c 100644 (file)
@@ -88,7 +88,7 @@ class ApiMove extends ApiBase {
                        $r['redirectcreated'] = '';
                }
 
-               if( $toTitleExists ) {
+               if ( $toTitleExists ) {
                        $r['moveoverredirect'] = '';
                }
 
@@ -99,7 +99,7 @@ class ApiMove extends ApiBase {
                        if ( $retval === true ) {
                                $r['talkfrom'] = $fromTalk->getPrefixedText();
                                $r['talkto'] = $toTalk->getPrefixedText();
-                               if( $toTalkExists ) {
+                               if ( $toTalkExists ) {
                                        $r['talkmoveoverredirect'] = '';
                                }
                        } else {
index f13a50e..b68dc5c 100644 (file)
@@ -42,15 +42,15 @@ class ApiPurge extends ApiBase {
         */
        private static function addValues( array &$result, $values, $flag = null, $name = null ) {
                foreach ( $values as $val ) {
-                       if( $val instanceof Title ) {
+                       if ( $val instanceof Title ) {
                                $v = array();
                                ApiQueryBase::addTitleInfo( $v, $val );
-                       } elseif( $name !== null ) {
+                       } elseif ( $name !== null ) {
                                $v = array( $name => $val );
                        } else {
                                $v = $val;
                        }
-                       if( $flag !== null ) {
+                       if ( $flag !== null ) {
                                $v[$flag] = '';
                        }
                        $result[] = $v;
index c9811b0..d47c7b7 100644 (file)
@@ -87,7 +87,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
                        foreach ( $messages_target as $message ) {
                                // === 0: must be at beginning of string (position 0)
                                if ( strpos( $message, $params['prefix'] ) === 0 ) {
-                                       if( !$skip ) {
+                                       if ( !$skip ) {
                                                $skip = true;
                                        }
                                        $messages_filtered[] = $message;
index d718b96..0d0c10f 100644 (file)
@@ -174,7 +174,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $res = $this->select( __METHOD__ );
 
                //Get gender information
-               if( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
+               if ( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
                        $users = array();
                        foreach ( $res as $row ) {
                                $users[] = $row->page_title;
index 7283aa0..1948a51 100644 (file)
@@ -83,12 +83,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
 
                if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) {
                        $groups = array();
-                       foreach( $params['rights'] as $r ) {
+                       foreach ( $params['rights'] as $r ) {
                                $groups = array_merge( $groups, User::getGroupsWithPermission( $r ) );
                        }
 
                        // no group with the given right(s) exists, no need for a query
-                       if( !count( $groups ) ) {
+                       if ( !count( $groups ) ) {
                                $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), '' );
                                return;
                        }
index 6899808..e39c25a 100644 (file)
@@ -229,10 +229,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $orderBy = array();
                $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' );
                // Don't order by namespace/title if it's constant in the WHERE clause
-               if( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
+               if ( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
                        $orderBy[] = $this->bl_ns . $sort;
                }
-               if( count( array_unique( $allRedirDBkey ) ) != 1 ) {
+               if ( count( array_unique( $allRedirDBkey ) ) != 1 ) {
                        $orderBy[] = $this->bl_title . $sort;
                }
                $orderBy[] = $this->bl_from . $sort;
index ba90452..fa2a7c4 100644 (file)
@@ -94,8 +94,9 @@ class ApiQueryBlocks extends ApiQueryBase {
                        list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
                        if ( $ip && $range ) {
                                // We got a CIDR range
-                               if ( $range < 16 )
+                               if ( $range < 16 ) {
                                        $this->dieUsage( 'CIDR ranges broader than /16 are not accepted', 'cidrtoobroad' );
+                               }
                                $lower = wfBaseConvert( $ip, 10, 16, 8, false );
                                $upper = wfBaseConvert( $ip + pow( 2, 32 - $range ) - 1, 10, 16, 8, false );
                        } else {
index 31ca1ef..4a53409 100644 (file)
@@ -74,13 +74,13 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                if ( $mode == 'revs' || $mode == 'user' ) {
                        // Ignore namespace and unique due to inability to know whether they were purposely set
-                       foreach( array( 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ) as $p ) {
+                       foreach ( array( 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ) as $p ) {
                                if ( !is_null( $params[$p] ) ) {
                                        $this->dieUsage( "The '{$p}' parameter cannot be used in modes 1 or 2", 'badparams' );
                                }
                        }
                } else {
-                       foreach( array( 'start', 'end' ) as $p ) {
+                       foreach ( array( 'start', 'end' ) as $p ) {
                                if ( !is_null( $params[$p] ) ) {
                                        $this->dieUsage( "The {$p} parameter cannot be used in mode 3", 'badparams' );
                                }
index 7f73631..0311fa7 100644 (file)
@@ -58,7 +58,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                }
                $images = $namespaces[NS_FILE];
 
-               if( $params['dir'] == 'descending' ) {
+               if ( $params['dir'] == 'descending' ) {
                        $images = array_reverse( $images );
                }
 
@@ -79,7 +79,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                }
 
                $filesToFind = array_keys( $images );
-               if( $params['localonly'] ) {
+               if ( $params['localonly'] ) {
                        $files = RepoGroup::singleton()->getLocalRepo()->findFiles( $filesToFind );
                } else {
                        $files = RepoGroup::singleton()->findFiles( $filesToFind );
@@ -97,29 +97,29 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
 
                // find all files with the hashes, result format is: array( hash => array( dup1, dup2 ), hash1 => ... )
                $filesToFindBySha1s = array_unique( array_values( $sha1s ) );
-               if( $params['localonly'] ) {
+               if ( $params['localonly'] ) {
                        $filesBySha1s = RepoGroup::singleton()->getLocalRepo()->findBySha1s( $filesToFindBySha1s );
                } else {
                        $filesBySha1s = RepoGroup::singleton()->findBySha1s( $filesToFindBySha1s );
                }
 
                // iterate over $images to handle continue param correct
-               foreach( $images as $image => $pageId ) {
-                       if( !isset( $sha1s[$image] ) ) {
+               foreach ( $images as $image => $pageId ) {
+                       if ( !isset( $sha1s[$image] ) ) {
                                continue; //file does not exist
                        }
                        $sha1 = $sha1s[$image];
                        $dupFiles = $filesBySha1s[$sha1];
-                       if( $params['dir'] == 'descending' ) {
+                       if ( $params['dir'] == 'descending' ) {
                                $dupFiles = array_reverse( $dupFiles );
                        }
                        /** @var $dupFile File */
                        foreach ( $dupFiles as $dupFile ) {
                                $dupName = $dupFile->getName();
-                               if( $image == $dupName && $dupFile->isLocal() ) {
+                               if ( $image == $dupName && $dupFile->isLocal() ) {
                                        continue; //ignore the local file itself
                                }
-                               if( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) {
+                               if ( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) {
                                        continue; //skip to pos after the image from continue param
                                }
                                $skipUntilThisDup = false;
@@ -138,7 +138,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                                                'user' => $dupFile->getUser( 'text' ),
                                                'timestamp' => wfTimestamp( TS_ISO_8601, $dupFile->getTimestamp() )
                                        );
-                                       if( !$dupFile->isLocal() ) {
+                                       if ( !$dupFile->isLocal() ) {
                                                $r['shared'] = '';
                                        }
                                        $fit = $this->addPageSubItem( $pageId, $r );
@@ -148,7 +148,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                                        }
                                }
                        }
-                       if( !$fit ) {
+                       if ( !$fit ) {
                                break;
                        }
                }
index eb9cdf9..124d273 100644 (file)
@@ -123,7 +123,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                                if ( $fld_url ) {
                                        $to = $row->el_to;
                                        // expand protocol-relative urls
-                                       if( $params['expandurl'] ) {
+                                       if ( $params['expandurl'] ) {
                                                $to = wfExpandUrl( $to, PROTO_CANONICAL );
                                        }
                                        $vals['url'] = $to;
index 761b49e..56ee268 100644 (file)
@@ -88,7 +88,7 @@ class ApiQueryExternalLinks extends ApiQueryBase {
                        $entry = array();
                        $to = $row->el_to;
                        // expand protocol-relative urls
-                       if( $params['expandurl'] ) {
+                       if ( $params['expandurl'] ) {
                                $to = wfExpandUrl( $to, PROTO_CANONICAL );
                        }
                        ApiResult::setContent( $entry, $to );
index 0869cb9..c36821b 100644 (file)
@@ -72,7 +72,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
 
                        $result = $this->getResult();
                        //search only inside the local repo
-                       if( $params['localonly'] ) {
+                       if ( $params['localonly'] ) {
                                $images = RepoGroup::singleton()->getLocalRepo()->findFiles( $titles );
                        } else {
                                $images = RepoGroup::singleton()->findFiles( $titles );
index 37cd915..6dbda5f 100644 (file)
@@ -60,7 +60,7 @@ class ApiQueryInfo extends ApiQueryBase {
 
                $pageSet->requestField( 'page_restrictions' );
                // when resolving redirects, no page will have this field
-               if( !$pageSet->isResolvingRedirects() ) {
+               if ( !$pageSet->isResolvingRedirects() ) {
                        $pageSet->requestField( 'page_is_redirect' );
                }
                $pageSet->requestField( 'page_is_new' );
@@ -476,7 +476,7 @@ class ApiQueryInfo extends ApiQueryBase {
                                $this->protections[$title->getNamespace()][$title->getDBkey()][] = $a;
                        }
                        // Also check old restrictions
-                       foreach( $this->titles as $pageId => $title ) {
+                       foreach ( $this->titles as $pageId => $title ) {
                                if ( $this->pageRestrictions[$pageId] ) {
                                        $namespace = $title->getNamespace();
                                        $dbKey = $title->getDBkey();
index 73dcea4..33b70a4 100644 (file)
@@ -241,7 +241,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                break;
                        case 'rights':
                                $vals2 = array();
-                               if( $legacy ) {
+                               if ( $legacy ) {
                                        list( $vals2['old'], $vals2['new'] ) = $params;
                                } else {
                                        $vals2['new'] = implode( ', ', $params['5::newgroups'] );
index b03bdfb..9d0fd0a 100644 (file)
@@ -52,7 +52,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
                global $wgQueryPages;
                $this->qpMap = array();
                foreach ( $wgQueryPages as $page ) {
-                       if( !in_array( $page[1], $this->uselessQueryPages ) ) {
+                       if ( !in_array( $page[1], $this->uselessQueryPages ) ) {
                                $this->qpMap[$page[1]] = $page[0];
                        }
                }
index f79083e..37b22f1 100644 (file)
@@ -170,15 +170,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['lang'] = $GLOBALS['wgLanguageCode'];
 
                $fallbacks = array();
-               foreach( $wgContLang->getFallbackLanguages() as $code ) {
+               foreach ( $wgContLang->getFallbackLanguages() as $code ) {
                        $fallbacks[] = array( 'code' => $code );
                }
                $data['fallback'] = $fallbacks;
                $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
 
-               if( $wgContLang->hasVariants() ) {
+               if ( $wgContLang->hasVariants() ) {
                        $variants = array();
-                       foreach( $wgContLang->getVariants() as $code ) {
+                       foreach ( $wgContLang->getVariants() as $code ) {
                                $variants[] = array( 'code' => $code );
                        }
                        $data['variants'] = $variants;
@@ -345,10 +345,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                $val['language'] = $langNames[$prefix];
                        }
                        $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
-                       if( isset( $row['iw_wikiid'] ) ) {
+                       if ( isset( $row['iw_wikiid'] ) ) {
                                $val['wikiid'] = $row['iw_wikiid'];
                        }
-                       if( isset( $row['iw_api'] ) ) {
+                       if ( isset( $row['iw_api'] ) ) {
                                $val['api'] = $row['iw_api'];
                        }
 
@@ -520,7 +520,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                $data = array(
                        'url' => $url ? $url : '',
-                       'text' => $text ?  $text : ''
+                       'text' => $text ? $text : ''
                );
 
                return $this->getResult()->addValue( 'query', $property, $data );
index 597c412..6d20d66 100644 (file)
@@ -83,10 +83,10 @@ class ApiQueryContributions extends ApiQueryBase {
                // Do the actual query.
                $res = $this->select( __METHOD__ );
 
-               if( $this->fld_sizediff ) {
+               if ( $this->fld_sizediff ) {
                        $revIds = array();
                        foreach ( $res as $row ) {
-                               if( $row->rev_parent_id ) {
+                               if ( $row->rev_parent_id ) {
                                        $revIds[] = $row->rev_parent_id;
                                }
                        }
index 1a491ec..8e65b40 100644 (file)
@@ -167,8 +167,9 @@ class ApiQueryUserInfo extends ApiQueryBase {
                if ( $user->isNewbie() ) {
                        $categories[] = 'ip';
                        $categories[] = 'subnet';
-                       if ( !$user->isAnon() )
+                       if ( !$user->isAnon() ) {
                                $categories[] = 'newbie';
+                       }
                }
                $categories = array_merge( $categories, $user->getGroups() );
 
index 72ab786..0a0aaee 100644 (file)
@@ -127,7 +127,7 @@ class ApiQueryUsers extends ApiQueryBase {
                                $this->addFields( array( 'user_name', 'ug_group' ) );
                                $userGroupsRes = $this->select( __METHOD__ );
 
-                               foreach( $userGroupsRes as $row ) {
+                               foreach ( $userGroupsRes as $row ) {
                                        $userGroups[$row->user_name][] = $row->ug_group;
                                }
                        }
index 9d30729..a8d7115 100644 (file)
@@ -56,7 +56,7 @@ class ApiUpload extends ApiBase {
                $this->mParams['chunk'] = $request->getFileName( 'chunk' );
 
                // Copy the session key to the file key, for backward compatibility.
-               if( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
+               if ( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
                        $this->mParams['filekey'] = $this->mParams['sessionkey'];
                }
 
@@ -82,7 +82,7 @@ class ApiUpload extends ApiBase {
                // Check if the uploaded file is sane
                if ( $this->mParams['chunk'] ) {
                        $maxSize = $this->mUpload->getMaxUploadSize();
-                       if( $this->mParams['filesize'] > $maxSize ) {
+                       if ( $this->mParams['filesize'] > $maxSize ) {
                                $this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
                        }
                        if ( !$this->mUpload->getTitle() ) {
@@ -354,7 +354,7 @@ class ApiUpload extends ApiBase {
                if ( $this->mParams['chunk'] ) {
                        // Chunk upload
                        $this->mUpload = new UploadFromChunks();
-                       if( isset( $this->mParams['filekey'] ) ) {
+                       if ( isset( $this->mParams['filekey'] ) ) {
                                // handle new chunk
                                $this->mUpload->continueChunks(
                                        $this->mParams['filename'],