From: umherirrender Date: Fri, 19 Apr 2013 18:03:05 +0000 (+0200) Subject: Fixed spacing in api folder X-Git-Tag: 1.31.0-rc.0~19935 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=a35cce4be0bdace9c4203d69942f35cfd6681e3d;p=lhc%2Fweb%2Fwiklou.git Fixed spacing in api folder Added spaces before if, foreach Added some braces for one line statements Change-Id: Id7779dca4d1185245cf5764102b8de8b232c34b6 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 08fde7ab93..ee5aa97208 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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( , ), array( , ) ) - if( is_array( $key ) ) { + if ( is_array( $key ) ) { $error = $key; $key = array_shift( $error ); } diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 90432b95d3..ab0a7e9627 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -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 ); diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index 79ffcb0adf..1e35c349cc 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -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(); diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php index 278ea292d6..59ff324792 100644 --- a/includes/api/ApiCreateAccount.php +++ b/includes/api/ApiCreateAccount.php @@ -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() ); } diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index 42fb652047..a11563b047 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -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(); diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index b96ea37142..ddcd6ac4b8 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -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' ); } diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 3ecb0d5800..7a60e831b3 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -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; diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 1f0a5fab41..56af76f93e 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -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() ); } } diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 76f9b4201a..99847cf1d9 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -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, ); } diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 3e846e3be3..c18036cf37 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -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 { diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index f13a50e937..b68dc5cfa4 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -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; diff --git a/includes/api/ApiQueryAllMessages.php b/includes/api/ApiQueryAllMessages.php index c9811b0d93..d47c7b76ec 100644 --- a/includes/api/ApiQueryAllMessages.php +++ b/includes/api/ApiQueryAllMessages.php @@ -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; diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index d718b9673f..0d0c10f9da 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -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; diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 7283aa00e0..1948a51af8 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -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; } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 689980844b..e39c25ac44 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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; diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index ba904525ab..fa2a7c455b 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -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 { diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 31ca1ef592..4a53409fb7 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -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' ); } diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 7f73631ab6..0311fa7fec 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -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; } } diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index eb9cdf9e92..124d273fb4 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -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; diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index 761b49ea98..56ee268083 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -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 ); diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 0869cb9a08..c36821b481 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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 ); diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 37cd9159ad..6dbda5fb09 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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(); diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 73dcea494d..33b70a43ed 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -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'] ); diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index b03bdfb83a..9d0fd0ab1c 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -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]; } } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index f79083e12f..37b22f15b0 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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 ); diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 597c412d05..6d20d66506 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -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; } } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 1a491eca29..8e65b407bf 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -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() ); diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 72ab786685..0a0aaee11f 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -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; } } diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 9d30729c6f..a8d71154c4 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -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'],