From 0bc583af2cf5aef63e006288ab9fbfa61994e9a9 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 1 Dec 2013 21:39:00 +0100 Subject: [PATCH] Move closing parenthesis from multi line if and function to own line The Line continuation Coding conventions prefers the closing parenthesis on the same line than the beginning curly braces. This is done for ifs and functions. Also move some boolean operator from the end of a line to the beginning and changed some indentation to make the condition hopefully better readable. Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426 --- includes/Article.php | 4 +- includes/Block.php | 4 +- includes/Collation.php | 4 +- includes/EditPage.php | 26 ++++++------- includes/GlobalFunctions.php | 26 ++++++------- includes/HtmlFormatter.php | 8 +--- includes/ImagePage.php | 8 ++-- includes/Linker.php | 20 +++++----- includes/OutputPage.php | 4 +- includes/Preferences.php | 4 +- includes/Revision.php | 4 +- includes/Setup.php | 16 ++++---- includes/StreamFile.php | 4 +- includes/Title.php | 38 +++++++++---------- includes/User.php | 14 +++---- includes/UserMailer.php | 20 +++++----- includes/WebRequest.php | 4 +- includes/Wiki.php | 36 +++++++++--------- includes/logging/LogPage.php | 4 +- includes/logging/LogPager.php | 4 +- includes/logging/MoveLogFormatter.php | 4 +- includes/media/ExifBitmap.php | 20 +++++----- includes/media/GIFMetadataExtractor.php | 8 ++-- includes/media/IPTC.php | 4 +- includes/media/XMP.php | 20 +++++----- includes/objectcache/MemcachedClient.php | 6 +-- includes/objectcache/SqlBagOStuff.php | 8 ++-- includes/parser/LinkHolderArray.php | 4 +- includes/parser/Parser.php | 35 +++++++++-------- includes/parser/ParserOutput.php | 4 +- includes/parser/Preprocessor_DOM.php | 16 ++++---- includes/parser/Preprocessor_Hash.php | 20 +++++----- includes/profiler/Profiler.php | 4 +- includes/resourceloader/ResourceLoader.php | 4 +- .../ResourceLoaderFileModule.php | 4 +- includes/specials/SpecialSearch.php | 4 +- includes/specials/SpecialUpload.php | 8 ++-- includes/specials/SpecialWatchlist.php | 6 +-- includes/upload/UploadBase.php | 4 +- languages/Language.php | 17 ++++----- languages/LanguageConverter.php | 10 ++--- languages/utils/CLDRPluralRuleEvaluator.php | 8 ++-- maintenance/Maintenance.php | 10 ++--- maintenance/copyFileBackend.php | 4 +- maintenance/doMaintenance.php | 6 +-- maintenance/findHooks.php | 3 +- maintenance/pruneFileCache.php | 4 +- maintenance/rebuildImages.php | 13 +++++-- maintenance/storage/compressOld.php | 4 +- maintenance/storage/fixBug20757.php | 4 +- 50 files changed, 253 insertions(+), 265 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index ecbc59fa53..821c32ea69 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1552,8 +1552,8 @@ class Article implements Page { } if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ), - array( 'delete', $this->getTitle()->getPrefixedText() ) ) ) - { + array( 'delete', $this->getTitle()->getPrefixedText() ) ) + ) { # Flag to hide all contents of the archived revisions $suppress = $request->getVal( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' ); diff --git a/includes/Block.php b/includes/Block.php index 9aeb99b9d5..8673a3d818 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -63,8 +63,8 @@ class Block { */ function __construct( $address = '', $user = 0, $by = 0, $reason = '', $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, - $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '' ) - { + $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '' + ) { if ( $timestamp === 0 ) { $timestamp = wfTimestampNow(); } diff --git a/includes/Collation.php b/includes/Collation.php index b0252c70a0..ac2187c288 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -319,9 +319,7 @@ class IcuCollation extends Collation { // Check for CJK $firstChar = mb_substr( $string, 0, 1, 'UTF-8' ); - if ( ord( $firstChar ) > 0x7f - && self::isCjk( utf8ToCodepoint( $firstChar ) ) ) - { + if ( ord( $firstChar ) > 0x7f && self::isCjk( utf8ToCodepoint( $firstChar ) ) ) { return $firstChar; } diff --git a/includes/EditPage.php b/includes/EditPage.php index ab5856a1d0..c0e7ed2870 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -457,9 +457,9 @@ class EditPage { # Ignore some permissions errors when a user is just previewing/viewing diffs $remove = array(); foreach ( $permErrors as $error ) { - if ( ( $this->preview || $this->diff ) && - ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) ) - { + if ( ( $this->preview || $this->diff ) + && ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) + ) { $remove[] = $error; } } @@ -567,10 +567,10 @@ class EditPage { } elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) { // Standard preference behavior return true; - } elseif ( !$this->mTitle->exists() && - isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) && - $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) - { + } elseif ( !$this->mTitle->exists() + && isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) + && $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] + ) { // Categories are special return true; } else { @@ -728,9 +728,9 @@ class EditPage { $this->watchthis = $request->getCheck( 'wpWatchthis' ); # Don't force edit summaries when a user is editing their own user or talk page - if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && - $this->mTitle->getText() == $wgUser->getName() ) - { + if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) + && $this->mTitle->getText() == $wgUser->getName() + ) { $this->allowBlankSummary = true; } else { $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary' ); @@ -1792,9 +1792,9 @@ class EditPage { // Show the edit conflict page for certain recognized errors from doEdit(), // but don't show it for errors from extension hooks $errors = $doEditStatus->getErrorsArray(); - if ( in_array( $errors[0][0], array( 'edit-gone-missing', 'edit-conflict', - 'edit-already-exists' ) ) ) - { + if ( in_array( $errors[0][0], + array( 'edit-gone-missing', 'edit-conflict', 'edit-already-exists' ) ) + ) { $this->isConflict = true; // Destroys data doEdit() put in $status->value but who cares $doEditStatus->value = self::AS_END; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1f23537f81..819b076751 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -965,8 +965,8 @@ function wfIsDebugRawPage() { || ( isset( $_SERVER['SCRIPT_NAME'] ) && substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php' - ) ) - { + ) + ) { $cache = true; } else { $cache = false; @@ -1463,9 +1463,9 @@ function wfMsgForContent( $key ) { $args = func_get_args(); array_shift( $args ); $forcontent = true; - if ( is_array( $wgForceUIMsgAsContentMsg ) && - in_array( $key, $wgForceUIMsgAsContentMsg ) ) - { + if ( is_array( $wgForceUIMsgAsContentMsg ) + && in_array( $key, $wgForceUIMsgAsContentMsg ) + ) { $forcontent = false; } return wfMsgReal( $key, $args, true, $forcontent ); @@ -1486,9 +1486,9 @@ function wfMsgForContentNoTrans( $key ) { $args = func_get_args(); array_shift( $args ); $forcontent = true; - if ( is_array( $wgForceUIMsgAsContentMsg ) && - in_array( $key, $wgForceUIMsgAsContentMsg ) ) - { + if ( is_array( $wgForceUIMsgAsContentMsg ) + && in_array( $key, $wgForceUIMsgAsContentMsg ) + ) { $forcontent = false; } return wfMsgReal( $key, $args, true, $forcontent, false ); @@ -1993,11 +1993,11 @@ function wfClientAcceptsGzip( $force = false ) { # @todo FIXME: We may want to blacklist some broken browsers $m = array(); if ( preg_match( - '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/', - $_SERVER['HTTP_ACCEPT_ENCODING'], - $m ) - ) - { + '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/', + $_SERVER['HTTP_ACCEPT_ENCODING'], + $m + ) + ) { if ( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) { $result = false; return $result; diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php index 248a76fed0..c06fbbc97c 100644 --- a/includes/HtmlFormatter.php +++ b/includes/HtmlFormatter.php @@ -306,14 +306,10 @@ class HtmlFormatter { } elseif ( strpos( $selector, '#' ) === 0 ) { $type = 'ID'; $rawName = substr( $selector, 1 ); - } elseif ( strpos( $selector, '.' ) !== 0 && - strpos( $selector, '.' ) !== false ) - { + } elseif ( strpos( $selector, '.' ) !== 0 && strpos( $selector, '.' ) !== false ) { $type = 'TAG_CLASS'; $rawName = $selector; - } elseif ( strpos( $selector, '[' ) === false - && strpos( $selector, ']' ) === false ) - { + } elseif ( strpos( $selector, '[' ) === false && strpos( $selector, ']' ) === false ) { $type = 'TAG'; $rawName = $selector; } else { diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 4ea1712f04..b2a53cdb1b 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -377,8 +377,8 @@ class ImagePage extends Article { // since that is added to the message separately, so // it can be denoted as the current size being shown. if ( $size[0] <= $width_orig && $size[1] <= $height_orig - && $size[0] != $width && $size[1] != $height ) - { + && $size[0] != $width && $size[1] != $height + ) { $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] ); if ( $sizeLink ) { $otherSizes[] = $sizeLink; @@ -1203,8 +1203,8 @@ class ImageHistoryList extends ContextSource { $lang = $this->getLanguage(); $user = $this->getUser(); if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE, $user ) - && !$file->isDeleted( File::DELETED_FILE ) ) - { + && !$file->isDeleted( File::DELETED_FILE ) + ) { $params = array( 'width' => '120', 'height' => '120', diff --git a/includes/Linker.php b/includes/Linker.php index 1c1d82ee57..7c6bbc6035 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -264,8 +264,8 @@ class Linker { */ public static function linkKnown( $target, $html = null, $customAttribs = array(), - $query = array(), $options = array( 'known', 'noclasses' ) ) - { + $query = array(), $options = array( 'known', 'noclasses' ) + ) { return self::link( $target, $html, $customAttribs, $query, $options ); } @@ -562,8 +562,8 @@ class Linker { * @return String: HTML for an image, with links, wrappers, etc. */ public static function makeImageLink( /*Parser*/ $parser, Title $title, $file, $frameParams = array(), - $handlerParams = array(), $time = false, $query = "", $widthOption = null ) - { + $handlerParams = array(), $time = false, $query = "", $widthOption = null + ) { $res = null; $dummy = new DummyLinker; if ( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$dummy, &$title, @@ -749,8 +749,8 @@ class Linker { * @return mixed */ public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt, - $align = 'right', $params = array(), $framed = false, $manualthumb = "" ) - { + $align = 'right', $params = array(), $framed = false, $manualthumb = "" + ) { $frameParams = array( 'alt' => $alt, 'caption' => $label, @@ -775,8 +775,8 @@ class Linker { * @return mixed */ public static function makeThumbLink2( Title $title, $file, $frameParams = array(), - $handlerParams = array(), $time = false, $query = "" ) - { + $handlerParams = array(), $time = false, $query = "" + ) { global $wgStylePath, $wgContLang; $exists = $file && $file->exists(); @@ -1470,8 +1470,8 @@ class Linker { $target = Title::newFromText( $linkTarget ); if ( $target ) { if ( $target->getText() == '' && $target->getInterwiki() === '' - && !self::$commentLocal && self::$commentContextTitle ) - { + && !self::$commentLocal && self::$commentContextTitle + ) { $newTarget = clone ( self::$commentContextTitle ); $newTarget->setFragment( '#' . $target->getFragment() ); $target = $newTarget; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index f1c7d5bb03..a0d7e30c97 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -447,8 +447,8 @@ class OutputPage extends ContextSource { if ( $module instanceof ResourceLoaderModule && $module->getOrigin() <= $this->getAllowedModules( $type ) && ( is_null( $position ) || $module->getPosition() == $position ) - && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) ) ) - { + && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) ) + ) { $filteredModules[] = $val; } } diff --git a/includes/Preferences.php b/includes/Preferences.php index c9caf4f779..d4987706e4 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -682,8 +682,8 @@ class Preferences { $minDiff = $tz[1]; $tzSetting = sprintf( '%+03d:%02d', floor( $minDiff / 60 ), abs( $minDiff ) % 60 ); } elseif ( count( $tz ) > 1 && $tz[0] == 'ZoneInfo' && - !in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) ) ) - { + !in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) ) + ) { # Timezone offset can vary with DST $userTZ = timezone_open( $tz[2] ); if ( $userTZ !== false ) { diff --git a/includes/Revision.php b/includes/Revision.php index a01f515160..9c2521d812 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1311,8 +1311,8 @@ class Revision implements IDBAccessObject { global $wgLegacyEncoding; if ( $text !== false && $wgLegacyEncoding - && !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags ) ) - { + && !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags ) + ) { # Old revisions kept around in a legacy encoding? # Upconvert on demand. # ("utf8" checked for compatibility with some broken diff --git a/includes/Setup.php b/includes/Setup.php index 81dada2d3a..f75ee2983f 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -102,10 +102,10 @@ if ( isset( $wgFileStore['deleted']['directory'] ) ) { $wgDeletedDirectory = $wgFileStore['deleted']['directory']; } -if ( isset( $wgFooterIcons['copyright'] ) && - isset( $wgFooterIcons['copyright']['copyright'] ) && - $wgFooterIcons['copyright']['copyright'] === array() ) -{ +if ( isset( $wgFooterIcons['copyright'] ) + && isset( $wgFooterIcons['copyright']['copyright'] ) + && $wgFooterIcons['copyright']['copyright'] === array() +) { if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) { $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon; } elseif ( $wgRightsIcon || $wgRightsText ) { @@ -119,10 +119,10 @@ if ( isset( $wgFooterIcons['copyright'] ) && } } -if ( isset( $wgFooterIcons['poweredby'] ) && - isset( $wgFooterIcons['poweredby']['mediawiki'] ) && - $wgFooterIcons['poweredby']['mediawiki']['src'] === null ) -{ +if ( isset( $wgFooterIcons['poweredby'] ) + && isset( $wgFooterIcons['poweredby']['mediawiki'] ) + && $wgFooterIcons['poweredby']['mediawiki']['src'] === null +) { $wgFooterIcons['poweredby']['mediawiki']['src'] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png"; } diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 1ad643ac98..ef82705988 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -185,8 +185,8 @@ class StreamFile { return 'unknown/unknown'; } if ( $wgCheckFileExtensions && $wgStrictFileExtensions - && !UploadBase::checkFileExtensionList( $extList, $wgFileExtensions ) ) - { + && !UploadBase::checkFileExtensionList( $extList, $wgFileExtensions ) + ) { return 'unknown/unknown'; } if ( $wgVerifyMimeType && in_array( strtolower( $type ), $wgMimeTypeBlacklist ) ) { diff --git a/includes/Title.php b/includes/Title.php index c726e9d74b..2961500531 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1548,9 +1548,9 @@ class Title { $url = false; $matches = array(); - if ( !empty( $wgActionPaths ) && - preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) ) - { + if ( !empty( $wgActionPaths ) + && preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) + ) { $action = urldecode( $matches[2] ); if ( isset( $wgActionPaths[$action] ) ) { $query = $matches[1]; @@ -1564,12 +1564,12 @@ class Title { } } - if ( $url === false && - $wgVariantArticlePath && - $wgContLang->getCode() === $this->getPageLanguage()->getCode() && - $this->getPageLanguage()->hasVariants() && - preg_match( '/^variant=([^&]*)$/', $query, $matches ) ) - { + if ( $url === false + && $wgVariantArticlePath + && $wgContLang->getCode() === $this->getPageLanguage()->getCode() + && $this->getPageLanguage()->hasVariants() + && preg_match( '/^variant=([^&]*)$/', $query, $matches ) + ) { $variant = urldecode( $matches[1] ); if ( $this->getPageLanguage()->hasVariant( $variant ) ) { // Only do the variant replacement if the given variant is a valid @@ -2125,9 +2125,9 @@ class Title { if ( $title_protection['pt_create_perm'] == 'autoconfirmed' ) { $title_protection['pt_create_perm'] = 'editsemiprotected'; // B/C } - if ( $title_protection['pt_create_perm'] == '' || - !$user->isAllowed( $title_protection['pt_create_perm'] ) ) - { + if ( $title_protection['pt_create_perm'] == '' + || !$user->isAllowed( $title_protection['pt_create_perm'] ) + ) { $errors[] = array( 'titleprotected', User::whoIs( $title_protection['pt_user'] ), $title_protection['pt_reason'] ); } } @@ -2148,8 +2148,8 @@ class Title { } } elseif ( $action == 'delete' ) { if ( $doExpensiveQueries && $wgDeleteRevisionsLimit - && !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion() ) - { + && !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion() + ) { $errors[] = array( 'delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ); } } @@ -3216,8 +3216,8 @@ class Title { # Redundant interwiki prefix to the local wiki if ( $wgLocalInterwiki !== false - && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) - { + && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) + ) { if ( $dbkey == '' ) { # Can't have an empty self-link return false; @@ -3995,9 +3995,9 @@ class Title { // We don't know whether this function was called before // or after moving the root page, so check both // $this and $nt - if ( $oldSubpage->getArticleID() == $this->getArticleID() || - $oldSubpage->getArticleID() == $nt->getArticleID() ) - { + if ( $oldSubpage->getArticleID() == $this->getArticleID() + || $oldSubpage->getArticleID() == $nt->getArticleID() + ) { // When moving a page to a subpage of itself, // don't move it twice continue; diff --git a/includes/User.php b/includes/User.php index 8fcc68c75d..a2e702379a 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1307,8 +1307,8 @@ class User { // Proxy blocking if ( !$block instanceof Block && $ip !== null && !$this->isAllowed( 'proxyunbannable' ) - && !in_array( $ip, $wgProxyWhitelist ) ) - { + && !in_array( $ip, $wgProxyWhitelist ) + ) { // Local list if ( self::isLocallyBlockedProxy( $ip ) ) { $block = new Block; @@ -3078,9 +3078,7 @@ class User { // and when it does have to be executed, it can be on a slave // If this is the user's newtalk page, we always update the timestamp $force = ''; - if ( $title->getNamespace() == NS_USER_TALK && - $title->getText() == $this->getName() ) - { + if ( $title->getNamespace() == NS_USER_TALK && $title->getText() == $this->getName() ) { $force = 'force'; } @@ -3612,9 +3610,9 @@ class User { // Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted // Check for this with iconv $cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password ); - if ( $cp1252Password != $password && - self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) ) - { + if ( $cp1252Password != $password + && self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) + ) { return true; } } diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 6157f78122..39c3e18db6 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -630,11 +630,11 @@ class EmailNotification { // Send updates to watchers other than the current editor $userArray = UserArray::newFromIDs( $watchers ); foreach ( $userArray as $watchingUser ) { - if ( $watchingUser->getOption( 'enotifwatchlistpages' ) && - ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) ) && - $watchingUser->isEmailConfirmed() && - $watchingUser->getID() != $userTalkId ) - { + if ( $watchingUser->getOption( 'enotifwatchlistpages' ) + && ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) ) + && $watchingUser->isEmailConfirmed() + && $watchingUser->getID() != $userTalkId + ) { $this->compose( $watchingUser ); } } @@ -672,9 +672,9 @@ class EmailNotification { wfDebug( __METHOD__ . ": user talk page edited, but user does not exist\n" ); } elseif ( $targetUser->getId() == $editor->getId() ) { wfDebug( __METHOD__ . ": user edited their own talk page, no notification sent\n" ); - } elseif ( $targetUser->getOption( 'enotifusertalkpages' ) && - ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) ) - { + } elseif ( $targetUser->getOption( 'enotifusertalkpages' ) + && ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) + ) { if ( !$targetUser->isEmailConfirmed() ) { wfDebug( __METHOD__ . ": talk page owner doesn't have validated email\n" ); } elseif ( !wfRunHooks( 'AbortTalkPageEmailNotification', array( $targetUser, $title ) ) ) { @@ -782,8 +782,8 @@ class EmailNotification { $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); if ( $wgEnotifRevealEditorAddress && ( $this->editor->getEmail() != '' ) - && $this->editor->getOption( 'enotifrevealaddr' ) ) - { + && $this->editor->getOption( 'enotifrevealaddr' ) + ) { $editorAddress = new MailAddress( $this->editor ); if ( $wgEnotifFromEditor ) { $this->from = $editorAddress; diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 46cba5285f..dfa8cf6f93 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -113,8 +113,8 @@ class WebRequest { $router->add( "$wgScript/$1" ); if ( isset( $_SERVER['SCRIPT_NAME'] ) - && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) ) - { + && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) + ) { # Check for SCRIPT_NAME, we handle index.php explicitly # But we do have some other .php files such as img_auth.php # Don't let root article paths clober the parsing for them diff --git a/includes/Wiki.php b/includes/Wiki.php index 50bba7b9fc..5ebf5a0798 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -95,8 +95,8 @@ class MediaWiki { // Check variant links so that interwiki links don't have to worry // about the possible different language variants if ( count( $wgContLang->getVariants() ) > 1 - && !is_null( $ret ) && $ret->getArticleID() == 0 ) - { + && !is_null( $ret ) && $ret->getArticleID() == 0 + ) { $wgContLang->findVariantLink( $title, $ret ); } } @@ -197,9 +197,9 @@ class MediaWiki { wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) ); // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty. - if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) || - $title->isSpecial( 'Badtitle' ) ) - { + if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) + || $title->isSpecial( 'Badtitle' ) + ) { $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) ); wfProfileOut( __METHOD__ ); throw new BadTitleError(); @@ -242,8 +242,8 @@ class MediaWiki { } // Check for a redirect loop if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) - && $title->isLocal() ) - { + && $title->isLocal() + ) { // 301 so google et al report the target as the actual url. $output->redirect( $url, 301 ); } else { @@ -253,11 +253,11 @@ class MediaWiki { } // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant } elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted() - && ( $request->getVal( 'title' ) === null || - $title->getPrefixedDBkey() != $request->getVal( 'title' ) ) + && ( $request->getVal( 'title' ) === null + || $title->getPrefixedDBkey() != $request->getVal( 'title' ) ) && !count( $request->getValueNames( array( 'action', 'title' ) ) ) - && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) ) - { + && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) + ) { if ( $title->isSpecialPage() ) { list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); if ( $name ) { @@ -358,12 +358,12 @@ class MediaWiki { $action = $request->getVal( 'action', 'view' ); $file = ( $title->getNamespace() == NS_FILE ) ? $article->getFile() : null; if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content - && !$request->getVal( 'oldid' ) && // ... and are not old revisions - !$request->getVal( 'diff' ) && // ... and not when showing diff - $request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to + && !$request->getVal( 'oldid' ) // ... and are not old revisions + && !$request->getVal( 'diff' ) // ... and not when showing diff + && $request->getVal( 'redirect' ) != 'no' // ... unless explicitly told not to // ... and the article is not a non-redirect image page with associated file - !( is_object( $file ) && $file->exists() && !$file->getRedirected() ) ) - { + && !( is_object( $file ) && $file->exists() && !$file->getRedirected() ) + ) { // Give extensions a change to ignore/handle redirects as needed $ignoreRedirect = $target = false; @@ -420,8 +420,8 @@ class MediaWiki { $user = $this->context->getUser(); if ( !wfRunHooks( 'MediaWikiPerformAction', - array( $output, $page, $title, $user, $request, $this ) ) ) - { + array( $output, $page, $title, $user, $request, $this ) ) + ) { wfProfileOut( __METHOD__ ); return; } diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index bdae3666e0..d706cd7baf 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -233,8 +233,8 @@ class LogPage { * @return HTML string */ public static function actionText( $type, $action, $title = null, $skin = null, - $params = array(), $filterWikilinks = false ) - { + $params = array(), $filterWikilinks = false + ) { global $wgLang, $wgContLang, $wgLogActions; if ( is_null( $skin ) ) { diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index a11dcb7d85..9ce197ec61 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -245,8 +245,8 @@ class LogPager extends ReverseChronologicalPager { $index['log_search'] = 'ls_field_val'; $index['logging'] = 'PRIMARY'; if ( !$this->hasEqualsClause( 'ls_field' ) - || !$this->hasEqualsClause( 'ls_value' ) ) - { + || !$this->hasEqualsClause( 'ls_value' ) + ) { # Since (ls_field,ls_value,ls_logid) is unique, if the condition is # to match a specific (ls_field,ls_value) tuple, then there will be # no duplicate log rows. Otherwise, we need to remove the duplicates. diff --git a/includes/logging/MoveLogFormatter.php b/includes/logging/MoveLogFormatter.php index 0978f97686..c471b69f30 100644 --- a/includes/logging/MoveLogFormatter.php +++ b/includes/logging/MoveLogFormatter.php @@ -55,8 +55,8 @@ class MoveLogFormatter extends LogFormatter { public function getActionLinks() { if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden || $this->entry->getSubtype() !== 'move' - || !$this->context->getUser()->isAllowed( 'move' ) ) - { + || !$this->context->getUser()->isAllowed( 'move' ) + ) { return ''; } diff --git a/includes/media/ExifBitmap.php b/includes/media/ExifBitmap.php index d3fa36dddc..aa9db3aae7 100644 --- a/includes/media/ExifBitmap.php +++ b/includes/media/ExifBitmap.php @@ -97,12 +97,12 @@ class ExifBitmapHandler extends BitmapHandler { wfSuppressWarnings(); $exif = unserialize( $metadata ); wfRestoreWarnings(); - if ( !isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) || - $exif['MEDIAWIKI_EXIF_VERSION'] != Exif::version() ) - { - if ( isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) && - $exif['MEDIAWIKI_EXIF_VERSION'] == 1 ) - { + if ( !isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) + || $exif['MEDIAWIKI_EXIF_VERSION'] != Exif::version() + ) { + if ( isset( $exif['MEDIAWIKI_EXIF_VERSION'] ) + && $exif['MEDIAWIKI_EXIF_VERSION'] == 1 + ) { //back-compatible but old wfDebug( __METHOD__ . ": back-compat version\n" ); return self::METADATA_COMPATIBLE; @@ -129,10 +129,10 @@ class ExifBitmapHandler extends BitmapHandler { public function getCommonMetaArray( File $file ) { $metadata = $file->getMetadata(); - if ( $metadata === self::OLD_BROKEN_FILE || - $metadata === self::BROKEN_FILE || - $this->isMetadataValid( $file, $metadata ) === self::METADATA_BAD ) - { + if ( $metadata === self::OLD_BROKEN_FILE + || $metadata === self::BROKEN_FILE + || $this->isMetadataValid( $file, $metadata ) === self::METADATA_BAD + ) { // So we don't try and display metadata from PagedTiffHandler // for example when using InstantCommons. return array(); diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index 887afa3f13..77ec5a6abc 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -163,8 +163,8 @@ class GIFMetadataExtractor { $commentCount = count( $comment ); if ( $commentCount === 0 - || $comment[$commentCount - 1] !== $data ) - { + || $comment[$commentCount - 1] !== $data + ) { // Some applications repeat the same comment on each // frame of an animated GIF image, so if this comment // is identical to the last, only extract once. @@ -217,8 +217,8 @@ class GIFMetadataExtractor { $xmp = self::readBlock( $fh, true ); if ( substr( $xmp, -257, 3 ) !== "\x01\xFF\xFE" - || substr( $xmp, -4 ) !== "\x03\x02\x01\x00" ) - { + || substr( $xmp, -4 ) !== "\x03\x02\x01\x00" + ) { // this is just a sanity check. throw new Exception( "XMP does not have magic trailer!" ); } diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index dc163ac6c5..d3af31b3e3 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -315,9 +315,7 @@ class IPTC { foreach ( $codes as $ic ) { $fields = explode( ':', $ic, 3 ); - if ( count( $fields ) < 2 || - $fields[0] !== 'IPTC' ) - { + if ( count( $fields ) < 2 || $fields[0] !== 'IPTC' ) { wfDebugLog( 'IPTC', 'IPTC: ' . 'Invalid 2:12 - ' . $ic ); break; diff --git a/includes/media/XMP.php b/includes/media/XMP.php index 3b3105341f..351798630b 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -608,8 +608,8 @@ class XMPReader { function endElement( $parser, $elm ) { if ( $elm === ( self::NS_RDF . ' RDF' ) || $elm === 'adobe:ns:meta/ xmpmeta' - || $elm === 'adobe:ns:meta/ xapmeta' ) - { + || $elm === 'adobe:ns:meta/ xapmeta' + ) { // ignore these. return; } @@ -897,8 +897,8 @@ class XMPReader { if ( isset( $this->items[$ns][$tag] ) ) { if ( isset( $this->items[$ns][$this->ancestorStruct]['children'] ) - && !isset( $this->items[$ns][$this->ancestorStruct]['children'][$tag] ) ) - { + && !isset( $this->items[$ns][$this->ancestorStruct]['children'][$tag] ) + ) { // This assumes that we don't have inter-namespace nesting // which we don't in all the properties we're interested in. throw new MWException( " <$tag> appeared nested in <" . $this->ancestorStruct @@ -996,8 +996,8 @@ class XMPReader { throw new MWException( __METHOD__ . " expected but got $elm." ); } if ( !isset( $attribs[self::NS_XML . ' lang'] ) - || !preg_match( '/^[-A-Za-z0-9]{2,}$/D', $attribs[self::NS_XML . ' lang'] ) ) - { + || !preg_match( '/^[-A-Za-z0-9]{2,}$/D', $attribs[self::NS_XML . ' lang'] ) + ) { throw new MWException( __METHOD__ . " did not contain, or has invalid xml:lang attribute in lang alternative" ); } @@ -1026,8 +1026,8 @@ class XMPReader { if ( $elm === self::NS_RDF . ' RDF' || $elm === 'adobe:ns:meta/ xmpmeta' - || $elm === 'adobe:ns:meta/ xapmeta' ) - { + || $elm === 'adobe:ns:meta/ xapmeta' + ) { /* ignore. */ return; } elseif ( $elm === self::NS_RDF . ' Description' ) { @@ -1119,8 +1119,8 @@ class XMPReader { if ( isset( $attribs[self::NS_RDF . ' parseType'] ) && $attribs[self::NS_RDF . ' parseType'] === 'Resource' - && $this->mode[0] === self::MODE_SIMPLE ) - { + && $this->mode[0] === self::MODE_SIMPLE + ) { // this is equivalent to having an inner rdf:Description $this->mode[0] = self::MODE_QDESC; } diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php index e5f60b555c..f0a9128904 100644 --- a/includes/objectcache/MemcachedClient.php +++ b/includes/objectcache/MemcachedClient.php @@ -1026,9 +1026,9 @@ class MWMemcached { $len = strlen( $val ); - if ( $this->_have_zlib && $this->_compress_enable && - $this->_compress_threshold && $len >= $this->_compress_threshold ) - { + if ( $this->_have_zlib && $this->_compress_enable + && $this->_compress_threshold && $len >= $this->_compress_threshold + ) { $c_val = gzcompress( $val, 9 ); $c_len = strlen( $c_val ); diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 919b8b316c..e845b55405 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -114,8 +114,8 @@ class SqlBagOStuff extends BagOStuff { # Don't keep timing out trying to connect for each call if the DB is down if ( isset( $this->connFailureErrors[$serverIndex] ) - && ( time() - $this->connFailureTimes[$serverIndex] ) < 60 ) - { + && ( time() - $this->connFailureTimes[$serverIndex] ) < 60 + ) { throw $this->connFailureErrors[$serverIndex]; } @@ -678,8 +678,8 @@ class SqlBagOStuff extends BagOStuff { for ( $serverIndex = 0; $serverIndex < $this->numServers; $serverIndex++ ) { $db = $this->getDB( $serverIndex ); if ( $db->getType() !== 'mysql' - || version_compare( $db->getServerVersion(), '4.1.0', '<' ) ) - { + || version_compare( $db->getServerVersion(), '4.1.0', '<' ) + ) { throw new MWException( __METHOD__ . ' is not supported on this DB server' ); } diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index b629776dd2..40c0a89b82 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -160,8 +160,8 @@ class LinkHolderArray { $pos = 0; while ( $pos < strlen( $text ) ) { if ( !preg_match( '//', - $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) - { + $text, $m, PREG_OFFSET_CAPTURE, $pos ) + ) { break; } $ns = $m[1][0]; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3479b8f0f5..9be75ae943 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -420,8 +420,8 @@ class Parser { * d) it is an interface message (which is in the user language) */ if ( !( $options->getDisableContentConversion() - || isset( $this->mDoubleUnderscores['nocontentconvert'] ) ) ) - { + || isset( $this->mDoubleUnderscores['nocontentconvert'] ) ) + ) { if ( !$this->mOptions->getInterfaceMessage() ) { # The position of the convert() call should not be changed. it # assumes that the links are all replaced and the only thing left @@ -438,10 +438,10 @@ class Parser { * automatic link conversion. */ if ( !( $options->getDisableTitleConversion() - || isset( $this->mDoubleUnderscores['nocontentconvert'] ) - || isset( $this->mDoubleUnderscores['notitleconvert'] ) - || $this->mOutput->getDisplayTitle() !== false ) ) - { + || isset( $this->mDoubleUnderscores['nocontentconvert'] ) + || isset( $this->mDoubleUnderscores['notitleconvert'] ) + || $this->mOutput->getDisplayTitle() !== false ) + ) { $convruletitle = $this->getConverterLanguage()->getConvRuleTitle(); if ( $convruletitle ) { $this->mOutput->setTitleText( $convruletitle ); @@ -1696,9 +1696,9 @@ class Parser { public static function getExternalLinkRel( $url = false, $title = null ) { global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions; $ns = $title ? $title->getNamespace() : false; - if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions ) && - !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions ) ) - { + if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions ) + && !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions ) + ) { return 'nofollow'; } return null; @@ -1928,11 +1928,10 @@ class Parser { # Still some problems for cases where the ] is meant to be outside punctuation, # and no image is in sight. See bug 2095. # - if ( $text !== '' && - substr( $m[3], 0, 1 ) === ']' && - strpos( $text, '[' ) !== false - ) - { + if ( $text !== '' + && substr( $m[3], 0, 1 ) === ']' + && strpos( $text, '[' ) !== false + ) { $text .= ']'; # so that replaceExternalLinks($text) works later $m[3] = substr( $m[3], 1 ); } @@ -3387,8 +3386,8 @@ class Parser { if ( !$title->isExternal() ) { if ( $title->isSpecialPage() && $this->mOptions->getAllowSpecialInclusion() - && $this->ot['html'] ) - { + && $this->ot['html'] + ) { // Pass the template arguments as URL parameters. // "uselang" will have no effect since the Language object // is forced to the one defined in ParserOptions. @@ -3506,8 +3505,8 @@ class Parser { $text = wfEscapeWikiText( $text ); } elseif ( is_string( $text ) && !$piece['lineStart'] - && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) ) - { + && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) + ) { # Bug 529: if the template begins with a table or block-level # element, it should be treated as beginning a new line. # This behavior is somewhat controversial. diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 29502270f4..76d14cf64d 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -59,8 +59,8 @@ class ParserOutput extends CacheTime { const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#'; function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(), - $containsOldMagic = false, $titletext = '' ) - { + $containsOldMagic = false, $titletext = '' + ) { $this->mText = $text; $this->mLanguageLinks = $languageLinks; $this->mCategories = $categoryLinks; diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 57020a1459..6b2a874537 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -399,14 +399,14 @@ class Preprocessor_DOM implements Preprocessor { // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but // it's a possible beneficial b/c break. if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" - && substr( $text, $wsEnd + 1, 1 ) == "\n" ) - { + && substr( $text, $wsEnd + 1, 1 ) == "\n" + ) { // Remove leading whitespace from the end of the accumulator // Sanity check first though $wsLength = $i - $wsStart; if ( $wsLength > 0 - && strspn( $accum, " \t", -$wsLength ) === $wsLength ) - { + && strspn( $accum, " \t", -$wsLength ) === $wsLength + ) { $accum = substr( $accum, 0, -$wsLength ); } @@ -475,8 +475,8 @@ class Preprocessor_DOM implements Preprocessor { $attrEnd = $tagEndPos; // Find closing tag if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i", - $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) ) - { + $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) + ) { $inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 ); $i = $matches[0][1] + strlen( $matches[0][0] ); $close = '' . htmlspecialchars( $matches[0][0] ) . ''; @@ -1141,8 +1141,8 @@ class PPFrame_DOM implements PPFrame { # Remove it in HTML, pre+remove and STRIP_COMMENTS modes if ( $this->parser->ot['html'] || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) - || ( $flags & PPFrame::STRIP_COMMENTS ) ) - { + || ( $flags & PPFrame::STRIP_COMMENTS ) + ) { $out .= ''; } # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 2fc5e118ca..c2ab54e00d 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -326,15 +326,15 @@ class Preprocessor_Hash implements Preprocessor { // the overall start. That's not how Sanitizer::removeHTMLcomments() did it, but // it's a possible beneficial b/c break. if ( $wsStart > 0 && substr( $text, $wsStart - 1, 1 ) == "\n" - && substr( $text, $wsEnd + 1, 1 ) == "\n" ) - { + && substr( $text, $wsEnd + 1, 1 ) == "\n" + ) { // Remove leading whitespace from the end of the accumulator // Sanity check first though $wsLength = $i - $wsStart; if ( $wsLength > 0 && $accum->lastNode instanceof PPNode_Hash_Text - && strspn( $accum->lastNode->value, " \t", -$wsLength ) === $wsLength ) - { + && strspn( $accum->lastNode->value, " \t", -$wsLength ) === $wsLength + ) { $accum->lastNode->value = substr( $accum->lastNode->value, 0, -$wsLength ); } @@ -404,8 +404,8 @@ class Preprocessor_Hash implements Preprocessor { $attrEnd = $tagEndPos; // Find closing tag if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i", - $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) ) - { + $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) + ) { $inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 ); $i = $matches[0][1] + strlen( $matches[0][0] ); $close = $matches[0][0]; @@ -1062,8 +1062,8 @@ class PPFrame_Hash implements PPFrame { # Remove it in HTML, pre+remove and STRIP_COMMENTS modes if ( $this->parser->ot['html'] || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() ) - || ( $flags & PPFrame::STRIP_COMMENTS ) ) - { + || ( $flags & PPFrame::STRIP_COMMENTS ) + ) { $out .= ''; } # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result @@ -1654,8 +1654,8 @@ class PPNode_Hash_Tree implements PPNode { if ( $child->name === 'name' ) { $bits['name'] = $child; if ( $child->firstChild instanceof PPNode_Hash_Attr - && $child->firstChild->name === 'index' ) - { + && $child->firstChild->name === 'index' + ) { $bits['index'] = $child->firstChild->value; } } elseif ( $child->name === 'value' ) { diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 2282a3af40..235a5ad142 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -283,8 +283,8 @@ class Profiler { return; // short-circuit // @TODO: hardcoded check is a tad janky (what about FOR UPDATE?) } elseif ( !preg_match( '/^query-m: (?!SELECT)/', $method ) - && $realtime < $this->mDBLockThreshold ) - { + && $realtime < $this->mDBLockThreshold + ) { return; // not a DB master query nor slow enough } $now = microtime( true ); diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index f529568376..3b072f9a37 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -141,9 +141,7 @@ class ResourceLoader { // For empty/whitespace-only data or for unknown filters, don't perform // any caching or processing - if ( trim( $data ) === '' - || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) - { + if ( trim( $data ) === '' || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) { wfProfileOut( __METHOD__ ); return $data; } diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 818399953c..8a4847802c 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -538,8 +538,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { return $list[$key]; } elseif ( is_string( $fallback ) && isset( $list[$fallback] ) - && is_array( $list[$fallback] ) ) - { + && is_array( $list[$fallback] ) + ) { return $list[$fallback]; } return array(); diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 08e438f31b..bdcecf9477 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -107,8 +107,8 @@ class SpecialSearch extends SpecialPage { if ( $request->getVal( 'fulltext' ) || !is_null( $request->getVal( 'offset' ) ) - || !is_null( $request->getVal( 'searchx' ) ) ) - { + || !is_null( $request->getVal( 'searchx' ) ) + ) { $this->showResults( $search ); } else { $this->goResult( $search ); diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 0700c49742..5e1591d918 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -328,10 +328,10 @@ class SpecialUpload extends SpecialPage { # mDestWarningAck is set when some javascript has shown the warning # to the user. mForReUpload is set when the user clicks the "upload a # new version" link. - if ( !$warnings || ( count( $warnings ) == 1 && - isset( $warnings['exists'] ) && - ( $this->mDestWarningAck || $this->mForReUpload ) ) ) - { + if ( !$warnings || ( count( $warnings ) == 1 + && isset( $warnings['exists'] ) + && ( $this->mDestWarningAck || $this->mForReUpload ) ) + ) { return false; } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 154825a37c..9e93881e77 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -154,9 +154,9 @@ class SpecialWatchlist extends SpecialPage { wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults ); } - if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) && - $request->wasPosted() ) - { + if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) + && $request->wasPosted() + ) { $user->clearAllNotifications(); $output->redirect( $this->getTitle()->getFullURL( $nondefaults ) ); return; diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 183e7f3965..21b9b5f637 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -319,8 +319,8 @@ abstract class UploadBase { $error = ''; if ( !wfRunHooks( 'UploadVerification', - array( $this->mDestName, $this->mTempPath, &$error ) ) ) - { + array( $this->mDestName, $this->mTempPath, &$error ) ) + ) { wfProfileOut( __METHOD__ ); return array( 'status' => self::HOOK_ABORTED, 'error' => $error ); } diff --git a/languages/Language.php b/languages/Language.php index 2038baca98..dc1fc7de9d 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -213,8 +213,8 @@ class Language { protected static function newFromCode( $code ) { // Protect against path traversal below if ( !Language::isValidCode( $code ) - || strcspn( $code, ":/\\\000" ) !== strlen( $code ) ) - { + || strcspn( $code, ":/\\\000" ) !== strlen( $code ) + ) { throw new MWException( "Invalid language code \"$code\"" ); } @@ -1502,8 +1502,7 @@ class Language { if ( ( $zy > 1582 ) || ( ( $zy == 1582 ) && ( $zm > 10 ) ) || ( ( $zy == 1582 ) && ( $zm == 10 ) && ( $zd > 14 ) ) - ) - { + ) { $zjd = (int)( ( 1461 * ( $zy + 4800 + (int)( ( $zm - 14 ) / 12 ) ) ) / 4 ) + (int)( ( 367 * ( $zm - 2 - 12 * ( (int)( ( $zm - 14 ) / 12 ) ) ) ) / 12 ) - (int)( ( 3 * (int)( ( ( $zy + 4900 + (int)( ( $zm - 14 ) / 12 ) ) / 100 ) ) ) / 4 ) + @@ -1753,8 +1752,7 @@ class Language { ( ( $gy > 1912 ) && ( $gy < 1926 ) ) || ( ( $gy == 1926 ) && ( $gm < 12 ) ) || ( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd < 26 ) ) - ) - { + ) { # Taishō period $gy_gannen = $gy - 1912 + 1; $gy_offset = $gy_gannen; @@ -1766,8 +1764,7 @@ class Language { ( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd >= 26 ) ) || ( ( $gy > 1926 ) && ( $gy < 1989 ) ) || ( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd < 8 ) ) - ) - { + ) { # Shōwa period $gy_gannen = $gy - 1926 + 1; $gy_offset = $gy_gannen; @@ -4048,8 +4045,8 @@ class Language { public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) { // Protect against path traversal if ( !Language::isValidCode( $code ) - || strcspn( $code, ":/\\\000" ) !== strlen( $code ) ) - { + || strcspn( $code, ":/\\\000" ) !== strlen( $code ) + ) { throw new MWException( "Invalid language code \"$code\"" ); } diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 3059b2e0f2..cdaab2ce7b 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -401,9 +401,9 @@ class LanguageConverter { $startPos = $elementPos + strlen( $element ); // Translate any alt or title attributes inside the matched element - if ( $element !== '' && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element, - $elementMatches ) ) - { + if ( $element !== '' + && preg_match( '/^(<[^>\s]*)\s([^>]*)(.*)$/', $element, $elementMatches ) + ) { $attrs = Sanitizer::decodeTagAttributes( $elementMatches[2] ); $changed = false; foreach ( array( 'title', 'alt' ) as $attrName ) { @@ -1442,8 +1442,8 @@ class ConverterRule { } /* for unidirectional array fill to convert tables */ if ( ( $manLevel[$v] == 'bidirectional' || $manLevel[$v] == 'unidirectional' ) - && isset( $unidtable[$v] ) ) - { + && isset( $unidtable[$v] ) + ) { if ( isset( $this->mConvTable[$v] ) ) { $this->mConvTable[$v] = array_merge( $this->mConvTable[$v], $unidtable[$v] ); } else { diff --git a/languages/utils/CLDRPluralRuleEvaluator.php b/languages/utils/CLDRPluralRuleEvaluator.php index 68ac48c3e8..c2aede0249 100644 --- a/languages/utils/CLDRPluralRuleEvaluator.php +++ b/languages/utils/CLDRPluralRuleEvaluator.php @@ -185,8 +185,8 @@ class CLDRPluralRuleEvaluator_Range { foreach ( $this->parts as $part ) { if ( is_array( $part ) ) { if ( ( !$integerConstraint || floor( $number ) === (float)$number ) - && $number >= $part[0] && $number <= $part[1] ) - { + && $number >= $part[0] && $number <= $part[1] + ) { return true; } } else { @@ -450,8 +450,8 @@ class CLDRPluralRuleConverter { // Look ahead one word $nextTokenPos += strspn( $this->rule, self::WHITESPACE_CLASS, $nextTokenPos ); if ( $nextTokenPos < $this->end - && preg_match( self::WORD_REGEX, $this->rule, $m, 0, $nextTokenPos ) ) - { + && preg_match( self::WORD_REGEX, $this->rule, $m, 0, $nextTokenPos ) + ) { $word2 = strtolower( $m[0] ); $nextTokenPos += strlen( $word2 ); } diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 91a027ee4e..fb2cd8c68f 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -1273,9 +1273,9 @@ abstract class LoggedUpdateMaintenance extends Maintenance { $db = $this->getDB( DB_MASTER ); $key = $this->getUpdateKey(); - if ( !$this->hasOption( 'force' ) && - $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ ) ) - { + if ( !$this->hasOption( 'force' ) + && $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ ) + ) { $this->output( "..." . $this->updateSkippedMessage() . "\n" ); return true; } @@ -1284,9 +1284,7 @@ abstract class LoggedUpdateMaintenance extends Maintenance { return false; } - if ( - $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) ) - { + if ( $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) ) { return true; } else { $this->output( $this->updatelogFailedMessage() . "\n" ); diff --git a/maintenance/copyFileBackend.php b/maintenance/copyFileBackend.php index 49af0b89a8..09b9295e1a 100644 --- a/maintenance/copyFileBackend.php +++ b/maintenance/copyFileBackend.php @@ -239,8 +239,8 @@ class CopyFileBackend extends Maintenance { $this->error( "$wikiId: Detected illegal (non-UTF8) path for $srcPath." ); continue; } elseif ( !$this->hasOption( 'missingonly' ) - && $this->filesAreSame( $src, $dst, $srcPath, $dstPath ) ) - { + && $this->filesAreSame( $src, $dst, $srcPath, $dstPath ) + ) { $this->output( "\tAlready have $srcPathRel.\n" ); continue; // assume already copied... } diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index 3157318a7f..3dcf12cef0 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -90,9 +90,9 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) { require $maintenance->loadSettings(); } -if ( $maintenance->getDbType() === Maintenance::DB_ADMIN && - is_readable( "$IP/AdminSettings.php" ) ) -{ +if ( $maintenance->getDbType() === Maintenance::DB_ADMIN + && is_readable( "$IP/AdminSettings.php" ) +) { require "$IP/AdminSettings.php"; } diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index 373170ff53..52056ea5d8 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -103,8 +103,7 @@ class FindHooks extends Maintenance { $this->printArray( 'Documented and not found', $deprecated ); $this->printArray( 'Unclear hook calls', $bad ); - if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 ) - { + if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 ) { $this->output( "Looks good!\n" ); } } diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 48d3897790..01bd09a244 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -95,8 +95,8 @@ class PruneFileCache extends Maintenance { // Sanity check the file extension against known cache types if ( $mts < $this->minSurviveTimestamp && preg_match( '/\.(?:html|cache)(?:\.gz)?$/', $file ) - && unlink( $path ) ) - { + && unlink( $path ) + ) { $daysOld = round( ( $tsNow - $mts ) / 86400, 2 ); $this->output( "Deleted `$path` [days=$daysOld]\n" ); } diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index 53bf823f0f..ed67ccdcf7 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -205,9 +205,16 @@ class ImageBuilder extends Maintenance { } if ( !$this->dryrun ) { $file = wfLocalFile( $filename ); - if ( !$file->recordUpload( '', '(recovered file, missing upload log entry)', '', '', '', - false, $timestamp ) ) - { + if ( !$file->recordUpload( + '', + '(recovered file, missing upload log entry)', + '', + '', + '', + false, + $timestamp + ) + ) { $this->output( "Error uploading file $fullpath\n" ); return; } diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index 8cb554875b..3b59f1dfdb 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -177,8 +177,8 @@ class CompressOld extends Maintenance { * @return bool */ private function compressWithConcat( $startId, $maxChunkSize, $beginDate, - $endDate, $extdb = "", $maxPageId = false ) - { + $endDate, $extdb = "", $maxPageId = false + ) { $loadStyle = self::LS_CHUNKED; $dbr = wfGetDB( DB_SLAVE ); diff --git a/maintenance/storage/fixBug20757.php b/maintenance/storage/fixBug20757.php index 101aa068ba..e832b4e827 100644 --- a/maintenance/storage/fixBug20757.php +++ b/maintenance/storage/fixBug20757.php @@ -58,8 +58,8 @@ class FixBug20757 extends Maintenance { $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ ); if ( $dbr->getType() == 'mysql' - && version_compare( $dbr->getServerVersion(), '4.1.0', '>=' ) ) - { + && version_compare( $dbr->getServerVersion(), '4.1.0', '>=' ) + ) { // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))'; } else { -- 2.20.1