From 5ca5672aacfa855ed1ac8f5570b9f7d10c1eb0b0 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 1 Dec 2013 20:58:51 +0100 Subject: [PATCH] Fixed spacing - Place commas correct - Moved comments - Add space after if/foreach/catch - Reformat some conditions - Removed trailing spaces/tabs Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb --- includes/Cookie.php | 21 ++++-- includes/Exception.php | 6 +- includes/Export.php | 3 +- includes/GitInfo.php | 3 +- includes/HTMLForm.php | 3 +- includes/Html.php | 4 +- includes/HttpFunctions.php | 4 +- includes/LinkFilter.php | 2 +- includes/Linker.php | 8 +-- includes/Revision.php | 4 +- includes/User.php | 4 +- includes/Xml.php | 50 +++++++------- includes/cache/LocalisationCache.php | 2 +- includes/db/Database.php | 2 +- includes/media/FormatMetadata.php | 6 +- includes/media/XCF.php | 12 ++-- includes/parser/Parser.php | 21 +++--- includes/specials/SpecialExpandTemplates.php | 6 +- includes/templates/NoLocalSettings.php | 4 +- languages/LanguageConverter.php | 35 +++++----- languages/classes/LanguageDsb.php | 2 +- languages/classes/LanguageHsb.php | 2 +- maintenance/backupTextPass.inc | 4 +- maintenance/cdb.php | 2 +- maintenance/parse.php | 6 +- maintenance/userDupes.inc | 2 +- tests/phpunit/data/xmp/gps.result.php | 2 +- tests/phpunit/includes/LinkFilterTest.php | 68 +++++++++---------- tests/phpunit/includes/PreferencesTest.php | 6 +- tests/phpunit/includes/StatusTest.php | 6 +- .../api/query/ApiQueryContinueTestBase.php | 3 +- .../jobqueue/RefreshLinksPartitionTest.php | 20 +++--- .../includes/specials/SpecialSearchTest.php | 8 +-- 33 files changed, 169 insertions(+), 162 deletions(-) diff --git a/includes/Cookie.php b/includes/Cookie.php index ecf4667d15..e0a11a2073 100644 --- a/includes/Cookie.php +++ b/includes/Cookie.php @@ -131,8 +131,14 @@ class Cookie { } if ( substr( $domain, 0, 1 ) == '.' - && substr_compare( $originDomain, $domain, -strlen( $domain ), - strlen( $domain ), true ) != 0 ) { + && substr_compare( + $originDomain, + $domain, + -strlen( $domain ), + strlen( $domain ), + true + ) != 0 + ) { return false; } } @@ -167,8 +173,15 @@ class Cookie { if ( $domain == $this->domain || ( strlen( $domain ) > strlen( $this->domain ) && substr( $this->domain, 0, 1 ) == '.' - && substr_compare( $domain, $this->domain, -strlen( $this->domain ), - strlen( $this->domain ), true ) == 0 ) ) { + && substr_compare( + $domain, + $this->domain, + -strlen( $this->domain ), + strlen( $this->domain ), + true + ) == 0 + ) + ) { return true; } diff --git a/includes/Exception.php b/includes/Exception.php index 008be15a38..4548345cbf 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -619,9 +619,9 @@ class MWExceptionHandler { if ( $wgShowExceptionDetails ) { $message .= 'Original exception: ' . self::getLogMessage( $e ) . - "\nBacktrace:\n" . self::getRedactedTraceAsString( $e ) . - "\n\nException caught inside exception handler: " . self::getLogMessage( $e2 ) . - "\nBacktrace:\n" . self::getRedactedTraceAsString( $e2 ); + "\nBacktrace:\n" . self::getRedactedTraceAsString( $e ) . + "\n\nException caught inside exception handler: " . self::getLogMessage( $e2 ) . + "\nBacktrace:\n" . self::getRedactedTraceAsString( $e2 ); } else { $message .= "Exception caught inside exception handler.\n\n" . "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " . diff --git a/includes/Export.php b/includes/Export.php index 3d347633e4..b4a507d2b4 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -503,7 +503,8 @@ class XmlDumpWriter { 'xmlns' => "http://www.mediawiki.org/xml/export-$ver/", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " . - "http://www.mediawiki.org/xml/export-$ver.xsd", #TODO: how do we get a new version up there? + #TODO: how do we get a new version up there? + "http://www.mediawiki.org/xml/export-$ver.xsd", 'version' => $ver, 'xml:lang' => $wgLanguageCode ), null ) . diff --git a/includes/GitInfo.php b/includes/GitInfo.php index f49f9be138..e0bd5cd043 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -143,8 +143,7 @@ class GitInfo { } else { return (int)$commitDate; } - - } + } /** * Return the name of the current branch, or HEAD if not found diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 1680fd6bf0..385663a745 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -655,8 +655,7 @@ class HTMLForm extends ContextSource { . $this->getBody() . $this->getHiddenFields() . $this->getButtons() - . $this->mFooter - ; + . $this->mFooter; $html = $this->wrapForm( $html ); diff --git a/includes/Html.php b/includes/Html.php index 6977a69575..0eb6474be6 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -449,8 +449,8 @@ class Html { // numbers to be entered in 'type="number"' fields, allow // the special case 'step="any"'. - if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) ) || - $key === 'step' && $value !== 'any' ) { + if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) ) + || $key === 'step' && $value !== 'any' ) { continue; } diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 78c2ac7a38..da08aa251a 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -842,8 +842,8 @@ class PhpHttpRequest extends MWHttpRequest { $this->postData = wfArrayToCgi( $this->postData ); } - if ( $this->parsedUrl['scheme'] != 'http' && - $this->parsedUrl['scheme'] != 'https' ) { + if ( $this->parsedUrl['scheme'] != 'http' + && $this->parsedUrl['scheme'] != 'https' ) { $this->status->fatal( 'http-invalid-scheme', $this->parsedUrl['scheme'] ); } diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index 97834fe9d0..48d5cd8549 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -123,7 +123,7 @@ class LinkFilter { $bits['host'] = $domainpart . '@' . $mailparts[0]; } elseif ( $bits['scheme'] === 'mailto' ) { // domainpart of email address only, do not add '.' - $bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host']) ) ) ); + $bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) ); } else { $bits['host'] = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) ); if ( substr( $bits['host'], -1, 1 ) !== '.' ) { diff --git a/includes/Linker.php b/includes/Linker.php index 450b4ba5a9..1c1d82ee57 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -849,10 +849,10 @@ class Linker { if ( $page ) { $url = wfAppendQuery( $url, array( 'page' => $page ) ); } - if ( $manualthumb && - !isset( $fp['link-title'] ) && - !isset( $fp['link-url'] ) && - !isset( $fp['no-link'] ) ) { + if ( $manualthumb + && !isset( $fp['link-title'] ) + && !isset( $fp['link-url'] ) + && !isset( $fp['no-link'] ) ) { $fp['link-url'] = $url; } diff --git a/includes/Revision.php b/includes/Revision.php index 444617339c..a01f515160 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1453,14 +1453,14 @@ class Revision implements IDBAccessObject { $t = $title->getPrefixedDBkey(); throw new MWException( "Can't save non-default content model with \$wgContentHandlerUseDB disabled: " - . "model is $model , default for $t is $defaultModel" ); + . "model is $model , default for $t is $defaultModel" ); } if ( $this->getContentFormat() != $defaultFormat ) { $t = $title->getPrefixedDBkey(); throw new MWException( "Can't use non-default content format with \$wgContentHandlerUseDB disabled: " - . "format is $format, default for $t is $defaultFormat" ); + . "format is $format, default for $t is $defaultFormat" ); } } diff --git a/includes/User.php b/includes/User.php index a01444a1a9..8fcc68c75d 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1632,8 +1632,8 @@ class User { $blocked = $this->isBlocked( $bFromSlave ); $allowUsertalk = ( $wgBlockAllowsUTEdit ? $this->mAllowUsertalk : false ); // If a user's name is suppressed, they cannot make edits anywhere - if ( !$this->mHideName && $allowUsertalk && $title->getText() === $this->getName() && - $title->getNamespace() == NS_USER_TALK ) { + if ( !$this->mHideName && $allowUsertalk && $title->getText() === $this->getName() + && $title->getNamespace() == NS_USER_TALK ) { $blocked = false; wfDebug( __METHOD__ . ": self-talk page, ignoring any blocks\n" ); } diff --git a/includes/Xml.php b/includes/Xml.php index ac0539d16c..45441fd623 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -500,34 +500,34 @@ class Xml { $options = self::option( $other, 'other', $selected === 'other' ); foreach ( explode( "\n", $list ) as $option ) { - $value = trim( $option ); - if ( $value == '' ) { - continue; - } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) { - // A new group is starting ... - $value = trim( substr( $value, 1 ) ); - if ( $optgroup ) { - $options .= self::closeElement( 'optgroup' ); - } - $options .= self::openElement( 'optgroup', array( 'label' => $value ) ); - $optgroup = true; - } elseif ( substr( $value, 0, 2 ) == '**' ) { - // groupmember - $value = trim( substr( $value, 2 ) ); - $options .= self::option( $value, $value, $selected === $value ); - } else { - // groupless reason list - if ( $optgroup ) { - $options .= self::closeElement( 'optgroup' ); - } - $options .= self::option( $value, $value, $selected === $value ); - $optgroup = false; + $value = trim( $option ); + if ( $value == '' ) { + continue; + } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) { + // A new group is starting ... + $value = trim( substr( $value, 1 ) ); + if ( $optgroup ) { + $options .= self::closeElement( 'optgroup' ); } + $options .= self::openElement( 'optgroup', array( 'label' => $value ) ); + $optgroup = true; + } elseif ( substr( $value, 0, 2 ) == '**' ) { + // groupmember + $value = trim( substr( $value, 2 ) ); + $options .= self::option( $value, $value, $selected === $value ); + } else { + // groupless reason list + if ( $optgroup ) { + $options .= self::closeElement( 'optgroup' ); + } + $options .= self::option( $value, $value, $selected === $value ); + $optgroup = false; } + } - if ( $optgroup ) { - $options .= self::closeElement( 'optgroup' ); - } + if ( $optgroup ) { + $options .= self::closeElement( 'optgroup' ); + } $attribs = array(); diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index f02e0a1a69..ccb94a2c5b 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -1197,7 +1197,7 @@ class LCStoreCDB implements LCStore { if ( file_exists( $fileName ) ) { try { $this->readers[$code] = CdbReader::open( $fileName ); - } catch( CdbException $e ) { + } catch ( CdbException $e ) { wfDebug( __METHOD__ . ": unable to open cdb file for reading" ); } } diff --git a/includes/db/Database.php b/includes/db/Database.php index f70934b08f..7275bd998c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1105,7 +1105,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { wfDebug( "SQL ERROR (ignored): $error\n" ); $this->ignoreErrors( $ignore ); } else { - $sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5*1024 ); + $sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5 * 1024 ); wfLogDBError( "$fname\t{$this->mServer}\t$errno\t$error\t$sql1line\n" ); wfDebug( "SQL ERROR: " . $error . "\n" ); throw new DBQueryError( $this, $error, $errno, $sql, $fname ); diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 390b2173aa..74e51cfb8e 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -1617,8 +1617,7 @@ class FormatMetadata extends ContextSource { * @return mixed value in best language, null if there were no languages at all * @since 1.23 */ - protected function resolveMultilangValue( $value ) - { + protected function resolveMultilangValue( $value ) { if ( !is_array( $value ) || !isset( $value['_type'] ) @@ -1732,8 +1731,7 @@ class FormatMetadata extends ContextSource { * @return array * @since 1.23 */ - protected function getPriorityLanguages() - { + protected function getPriorityLanguages() { $priorityLanguages = Language::getFallbacksIncludingSiteLanguage( $this->getLanguage()->getCode() ); $priorityLanguages = array_merge( (array) $this->getLanguage()->getCode(), $priorityLanguages[0], $priorityLanguages[1] ); return $priorityLanguages; diff --git a/includes/media/XCF.php b/includes/media/XCF.php index e77d384229..a80a0c8d61 100644 --- a/includes/media/XCF.php +++ b/includes/media/XCF.php @@ -103,12 +103,12 @@ class XCFHandler extends BitmapHandler { # (enum GimpImageBaseType in libgimpbase/gimpbaseenums.h) try { $header = wfUnpack( - "A9magic" # A: space padded - . "/a5version" # a: zero padded - . "/Nwidth" # \ - . "/Nheight" # N: unsigned long 32bit big endian - . "/Nbase_type" # / - , $binaryHeader + "A9magic" . # A: space padded + "/a5version" . # a: zero padded + "/Nwidth" . # \ + "/Nheight" . # N: unsigned long 32bit big endian + "/Nbase_type", # / + $binaryHeader ); } catch ( MWException $mwe ) { return false; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2df3160dc8..3479b8f0f5 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1788,14 +1788,14 @@ class Parser { $imagematch = false; } if ( $this->mOptions->getAllowExternalImages() - || ( $imagesexception && $imagematch ) ) { + || ( $imagesexception && $imagematch ) ) { if ( preg_match( self::EXT_IMAGE_REGEX, $url ) ) { # Image found $text = Linker::makeExternalImage( $url ); } } if ( !$text && $this->mOptions->getEnableImageWhitelist() - && preg_match( self::EXT_IMAGE_REGEX, $url ) ) { + && preg_match( self::EXT_IMAGE_REGEX, $url ) ) { $whitelist = explode( "\n", wfMessage( 'external_image_whitelist' )->inContentLanguage()->text() ); foreach ( $whitelist as $entry ) { # Sanitize the regex fragment, make it case-insensitive, ignore blank entries/comments @@ -3947,11 +3947,10 @@ class Parser { $object = false; $text = $frame->getArgument( $argName ); if ( $text === false && $parts->getLength() > 0 - && ( - $this->ot['html'] - || $this->ot['pre'] - || ( $this->ot['wiki'] && $frame->isTemplate() ) - ) + && ( $this->ot['html'] + || $this->ot['pre'] + || ( $this->ot['wiki'] && $frame->isTemplate() ) + ) ) { # No match in frame, use the supplied default $object = $parts->item( 0 )->getChildren(); @@ -5432,10 +5431,10 @@ class Parser { $params['frame']['caption'] = $caption; # Will the image be presented in a frame, with the caption below? - $imageIsFramed = isset( $params['frame']['frame'] ) || - isset( $params['frame']['framed'] ) || - isset( $params['frame']['thumbnail'] ) || - isset( $params['frame']['manualthumb'] ); + $imageIsFramed = isset( $params['frame']['frame'] ) + || isset( $params['frame']['framed'] ) + || isset( $params['frame']['thumbnail'] ) + || isset( $params['frame']['manualthumb'] ); # In the old days, [[Image:Foo|text...]] would set alt text. Later it # came to also set the caption, ordinary text after the image -- which diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index b566b918d0..a78133cb38 100644 --- a/includes/specials/SpecialExpandTemplates.php +++ b/includes/specials/SpecialExpandTemplates.php @@ -93,7 +93,7 @@ class SpecialExpandTemplates extends SpecialPage { $out->addWikiMsg( 'expand_templates_intro' ); $out->addHTML( $this->makeForm( $titleStr, $input ) ); - if( $output !== false ) { + if ( $output !== false ) { if ( $this->generateXML && strlen( $output ) > 0 ) { $out->addHTML( $this->makeOutput( $xml, 'expand_templates_xml_output' ) ); } @@ -108,7 +108,7 @@ class SpecialExpandTemplates extends SpecialPage { ); } - if( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) { + if ( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) { $tmp = MWTidy::tidy( $tmp ); } @@ -127,7 +127,7 @@ class SpecialExpandTemplates extends SpecialPage { */ private function makeForm( $title, $input ) { $self = $this->getTitle(); - $form = Xml::openElement( + $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) ); diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php index 0006df40a4..3f49ed3292 100644 --- a/includes/templates/NoLocalSettings.php +++ b/includes/templates/NoLocalSettings.php @@ -33,8 +33,8 @@ if ( !isset( $wgVersion ) ) { $matches = array(); $ext = 'php'; $path = '/'; -foreach( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) { - if( !preg_match( '/\.(php5?)$/', $part, $matches ) ) { +foreach ( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) { + if ( !preg_match( '/\.(php5?)$/', $part, $matches ) ) { $path .= "$part/"; } else { $ext = $matches[1] == 'php5' ? 'php5' : 'php'; diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index d4c38afb16..3059b2e0f2 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -102,8 +102,7 @@ class LanguageConverter { 'R' => 'R', // raw content 'D' => 'D', // convert description (subclass implement) '-' => '-', // remove convert (not implement) - 'H' => 'H', // add rule for convert code - // (but no display in placed code) + 'H' => 'H', // add rule for convert code (but no display in placed code) 'N' => 'N' // current variant name ); $this->mFlags = array_merge( $defaultflags, $flags ); @@ -778,12 +777,12 @@ class LanguageConverter { $ns = NS_MAIN; if ( $disableLinkConversion || - ( !$ignoreOtherCond && - ( $isredir == 'no' - || $action == 'edit' - || $action == 'submit' - || $linkconvert == 'no' - || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) ) { + ( !$ignoreOtherCond && + ( $isredir == 'no' + || $action == 'edit' + || $action == 'submit' + || $linkconvert == 'no' + || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) ) { return; } @@ -876,8 +875,7 @@ class LanguageConverter { $this->mTables = $wgLangConvMemc->get( $this->mCacheKey ); wfProfileOut( __METHOD__ . '-cache' ); } - if ( !$this->mTables - || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) { + if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) { wfProfileIn( __METHOD__ . '-recache' ); // not in cache, or we need a fresh reload. // We will first load the default tables @@ -1004,8 +1002,7 @@ class LanguageConverter { continue; } $mappings = explode( '}-', $block, 2 ); - $stripped = str_replace( array( "'", '"', '*', '#' ), '', - $mappings[0] ); + $stripped = str_replace( array( "'", '"', '*', '#' ), '', $mappings[0] ); $table = StringUtils::explode( ';', $stripped ); foreach ( $table as $t ) { $m = explode( '=>', $t, 3 ); @@ -1285,9 +1282,9 @@ class ConverterRule { $from = trim( $u[0] ); $v = trim( $u[1] ); if ( array_key_exists( $v, $unidtable ) - && !is_array( $unidtable[$v] ) - && $to - && in_array( $v, $variants ) ) { + && !is_array( $unidtable[$v] ) + && $to + && in_array( $v, $variants ) ) { $unidtable[$v] = array( $from => $to ); } elseif ( $to && in_array( $v, $variants ) ) { $unidtable[$v][$from] = $to; @@ -1353,8 +1350,7 @@ class ConverterRule { $disp = $disp[0]; } // or display frist text under disable manual convert - if ( !$disp - && $this->mConverter->mManualLevel[$variant] == 'disable' ) { + if ( !$disp && $this->mConverter->mManualLevel[$variant] == 'disable' ) { if ( count( $bidtable ) > 0 ) { $disp = array_values( $bidtable ); $disp = $disp[0]; @@ -1477,8 +1473,9 @@ class ConverterRule { // then convert to current language $this->mRules = $this->mConverter->autoConvert( $this->mRules, $variant ); - } else { // if current variant no in flags, - // then we check its fallback variants. + } else { + // if current variant no in flags, + // then we check its fallback variants. $variantFallbacks = $this->mConverter->getVariantFallbacks( $variant ); if ( is_array( $variantFallbacks ) ) { diff --git a/languages/classes/LanguageDsb.php b/languages/classes/LanguageDsb.php index 975157f41e..0ae0524277 100644 --- a/languages/classes/LanguageDsb.php +++ b/languages/classes/LanguageDsb.php @@ -49,7 +49,7 @@ class LanguageDsb extends Language { case 'lokatiw': # lokatiw $word = 'wo ' . $word; break; - } + } return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values } diff --git a/languages/classes/LanguageHsb.php b/languages/classes/LanguageHsb.php index 5623f3ce3d..1fc1404472 100644 --- a/languages/classes/LanguageHsb.php +++ b/languages/classes/LanguageHsb.php @@ -49,7 +49,7 @@ class LanguageHsb extends Language { case 'lokatiw': # lokatiw $word = 'wo ' . $word; break; - } + } return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values } diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index a51e6eefa8..f16772c516 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -417,8 +417,8 @@ class TextPassDumper extends BackupDumper { $text = false; // The candidate for a good text. false if no proper value. $failures = 0; // The number of times, this invocation of getText already failed. - static $consecutiveFailedTextRetrievals = 0; // The number of times getText failed without - // yielding a good text in between. + // The number of times getText failed without yielding a good text in between. + static $consecutiveFailedTextRetrievals = 0; $this->fetchCount++; diff --git a/maintenance/cdb.php b/maintenance/cdb.php index 1772b5f34e..4590611896 100644 --- a/maintenance/cdb.php +++ b/maintenance/cdb.php @@ -77,7 +77,7 @@ do { print "Loading cdb file $file..."; try { $fileHandle = CdbReader::open( $file ); - } catch( CdbException $e ) {} + } catch ( CdbException $e ) {} if ( !$fileHandle ) { print "not a cdb file or unable to read it\n"; diff --git a/maintenance/parse.php b/maintenance/parse.php index 3ac7a281d0..77657844ac 100644 --- a/maintenance/parse.php +++ b/maintenance/parse.php @@ -123,9 +123,9 @@ class CLIParser extends Maintenance { */ protected function parse( $wikitext ) { return $this->parser->parse( - $wikitext - , $this->getTitle() - , new ParserOptions() + $wikitext, + $this->getTitle(), + new ParserOptions() ); } } diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 8bd80c9786..44a1aab91a 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -184,7 +184,7 @@ class UserDupes { function getDupes() { $user = $this->db->tableName( 'user' ); $result = $this->db->query( - "SELECT user_name,COUNT(*) AS n + "SELECT user_name,COUNT(*) AS n FROM $user GROUP BY user_name HAVING n > 1", __METHOD__ ); diff --git a/tests/phpunit/data/xmp/gps.result.php b/tests/phpunit/data/xmp/gps.result.php index 8ea9c68ca0..bf7fb21902 100644 --- a/tests/phpunit/data/xmp/gps.result.php +++ b/tests/phpunit/data/xmp/gps.result.php @@ -7,5 +7,5 @@ $result = array( 'xmp-exif' => 'GPSLatitude' => 88.51805555, 'GPSLongitude' => -21.12356945, 'GPSVersionID' => '2.2.0.0' - ) + ) ); diff --git a/tests/phpunit/includes/LinkFilterTest.php b/tests/phpunit/includes/LinkFilterTest.php index 1ca8e9f065..41207b749c 100644 --- a/tests/phpunit/includes/LinkFilterTest.php +++ b/tests/phpunit/includes/LinkFilterTest.php @@ -70,38 +70,38 @@ class LinkFilterTest extends MediaWikiLangTestCase { return array( // Protocol, Search pattern, URL which matches the pattern - array( 'http://' , '*.test.com' , 'http://www.test.com' ), - array( 'http://' , 'test.com:8080/dir/file' , 'http://name:pass@test.com:8080/dir/file' ), - array( 'https://' , '*.com' , 'https://s.s.test..com:88/dir/file?a=1&b=2' ), - array( 'https://' , '*.com' , 'https://name:pass@secure.com/index.html' ), - array( 'http://' , 'name:pass@test.com' , 'http://test.com' ), - array( 'http://' , 'test.com' , 'http://name:pass@test.com' ), - array( 'http://' , '*.test.com' , 'http://a.b.c.test.com/dir/dir/file?a=6'), - array( null , 'http://*.test.com' , 'http://www.test.com' ), - array( 'mailto:' , 'name@mail.test123.com' , 'mailto:name@mail.test123.com' ), - array( '' , - 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' , + array( 'http://', '*.test.com', 'http://www.test.com' ), + array( 'http://', 'test.com:8080/dir/file', 'http://name:pass@test.com:8080/dir/file' ), + array( 'https://', '*.com', 'https://s.s.test..com:88/dir/file?a=1&b=2' ), + array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ), + array( 'http://', 'name:pass@test.com', 'http://test.com' ), + array( 'http://', 'test.com', 'http://name:pass@test.com' ), + array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'), + array( null, 'http://*.test.com', 'http://www.test.com' ), + array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ), + array( '', + 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg', 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ), - array( '' , 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' , + array( '', 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg', 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ), - array( '' , 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]' , + array( '', 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]', 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ), - array( 'http://' , 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' , + array( 'http://', 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg', 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ), - array( '' , 'http://name:pass@www.test.com:12345' , + array( '', 'http://name:pass@www.test.com:12345', 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ), array( 'ftp://', 'user:pass@ftp.test.com:1233/home/user/file;type=efw', 'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ), - array( null , 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=', + array( null, 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=', 'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ), - array( null , 'ftp://@ftp.test.com:1233/home/user/file;type=', + array( null, 'ftp://@ftp.test.com:1233/home/user/file;type=', 'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ), - array( null , 'ftp://ftp.test.com/', + array( null, 'ftp://ftp.test.com/', 'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ), - array( null , 'ftp://ftp.test.com/', + array( null, 'ftp://ftp.test.com/', 'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ), - array( null , 'ftp://*.test.com:222/', + array( null, 'ftp://*.test.com:222/', 'ftp://user:pass@ftp.test.com:222/home' ), array( 'irc://', '*.myserver:6667/', 'irc://test.myserver:6667/' ), array( 'irc://', 'name:pass@*.myserver/', 'irc://test.myserver:6667/' ), @@ -115,15 +115,15 @@ class LinkFilterTest extends MediaWikiLangTestCase { array( 'mailto:', 'test.com', 'mailto:name@test.com' ), array( 'news:', 'test.1234afc@news.test.com', 'news:test.1234afc@news.test.com' ), array( 'news:', '*.test.com', 'news:test.1234afc@news.test.com' ), - array( '' , 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com', + array( '', 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com', 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ), - array( '' , 'news:*.aol.com', + array( '', 'news:*.aol.com', 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ), - array( '' , 'git://github.com/prwef/abc-def.git' , 'git://github.com/prwef/abc-def.git' ), - array( 'git://' , 'github.com/' , 'git://github.com/prwef/abc-def.git' ), - array( 'git://' , '*.github.com/' , 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ), - array( '' , 'gopher://*.test.com/' , 'gopher://gopher.test.com/0/v2/vstat'), - array( 'telnet://' , '*.test.com' , 'telnet://shell.test.com/~home/'), + array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ), + array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ), + array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ), + array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'), + array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'), // // The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats @@ -140,12 +140,12 @@ class LinkFilterTest extends MediaWikiLangTestCase { // // Tests for false positives // - array( 'http://' , 'test.com' , 'http://www.test.com', false ), - array( 'http://' , 'www1.test.com' , 'http://www.test.com', false ), - array( 'http://' , '*.test.com' , 'http://www.test.t.com', false ), - array( '' , 'http://test.com:8080' , 'http://www.test.com:8080', false ), - array( '' , 'https://test.com' , 'http://test.com', false ), - array( '' , 'http://test.com' , 'https://test.com', false ), + array( 'http://', 'test.com', 'http://www.test.com', false ), + array( 'http://', 'www1.test.com', 'http://www.test.com', false ), + array( 'http://', '*.test.com', 'http://www.test.t.com', false ), + array( '', 'http://test.com:8080', 'http://www.test.com:8080', false ), + array( '', 'https://test.com', 'http://test.com', false ), + array( '', 'http://test.com', 'https://test.com', false ), array( 'http://', 'http://test.com', 'http://test.com', false ), array( null, 'http://www.test.com', 'http://www.test.com:80', false ), array( null, 'http://www.test.com:80', 'http://www.test.com', false ), @@ -205,7 +205,7 @@ class LinkFilterTest extends MediaWikiLangTestCase { $matches = 0; - foreach( $indexes as $index ) { + foreach ( $indexes as $index ) { $matches += preg_match( $regex, $index ); $debugmsg .= "\t'$index'\n"; } diff --git a/tests/phpunit/includes/PreferencesTest.php b/tests/phpunit/includes/PreferencesTest.php index 3dec2da041..5841bb6f07 100644 --- a/tests/phpunit/includes/PreferencesTest.php +++ b/tests/phpunit/includes/PreferencesTest.php @@ -81,9 +81,9 @@ class PreferencesTest extends MediaWikiTestCase { protected function prefsFor( $user_key ) { $preferences = array(); Preferences::profilePreferences( - $this->prefUsers[$user_key] - , $this->context - , $preferences + $this->prefUsers[$user_key], + $this->context, + $preferences ); return $preferences; diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 8ed21898ea..30a554e2a8 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -413,7 +413,7 @@ class StatusTest extends MediaWikiLangTestCase { */ public function testGetErrorMessage() { $method = new ReflectionMethod( 'Status', 'getErrorMessage' ); - $method->setAccessible(true); + $method->setAccessible( true ); $status = new Status(); $key = 'foo'; $params = array( 'bar' ); @@ -430,7 +430,7 @@ class StatusTest extends MediaWikiLangTestCase { */ public function testGetErrorMessageArray() { $method = new ReflectionMethod( 'Status', 'getErrorMessageArray' ); - $method->setAccessible(true); + $method->setAccessible( true ); $status = new Status(); $key = 'foo'; $params = array( 'bar' ); @@ -446,7 +446,7 @@ class StatusTest extends MediaWikiLangTestCase { $this->assertInternalType( 'array', $messageArray ); $this->assertCount( 2, $messageArray ); - foreach( $messageArray as $message ) { + foreach ( $messageArray as $message ) { $this->assertInstanceOf( 'Message', $message ); $this->assertEquals( $key, $message->getKey() ); $this->assertEquals( $params, $message->getParams() ); diff --git a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php index 54f35988d4..e7203c9671 100644 --- a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php @@ -152,7 +152,8 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { private static function GetItems( $q, $moduleName, $name, &$print ) { if ( isset( $q[$moduleName] ) ) { $print[] = "*$name/[" . implode( ',', - array_map( function ( $v ) { + array_map( + function ( $v ) { return $v['title']; }, $q[$moduleName] ) ) . ']'; diff --git a/tests/phpunit/includes/jobqueue/RefreshLinksPartitionTest.php b/tests/phpunit/includes/jobqueue/RefreshLinksPartitionTest.php index 398c5a2799..531a95474c 100644 --- a/tests/phpunit/includes/jobqueue/RefreshLinksPartitionTest.php +++ b/tests/phpunit/includes/jobqueue/RefreshLinksPartitionTest.php @@ -33,13 +33,13 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase { $title->getBacklinkCache()->clear(); $this->assertEquals( 20, $title->getBacklinkCache()->getNumLinks( 'pagelinks' ), 'Correct number of backlinks' ); - $job = new RefreshLinksJob( $title, array( 'recursive' => true, 'table' => 'pagelinks' ) + $job = new RefreshLinksJob( $title, array( 'recursive' => true, 'table' => 'pagelinks' ) + Job::newRootJobParams( "refreshlinks:pagelinks:{$title->getPrefixedText()}" ) ); $extraParams = $job->getRootJobParams(); $jobs = BacklinkJobUtils::partitionBacklinkJob( $job, 9, 1, array( 'params' => $extraParams ) ); $this->assertEquals( 10, count( $jobs ), 'Correct number of sub-jobs' ); - $this->assertEquals( $pages[0], current( $jobs[0]->params['pages'] ), + $this->assertEquals( $pages[0], current( $jobs[0]->params['pages'] ), 'First job is leaf job with proper title' ); $this->assertEquals( $pages[8], current( $jobs[8]->params['pages'] ), 'Last leaf job is leaf job with proper title' ); @@ -49,19 +49,19 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase { 'Last job is recursive sub-job' ); $this->assertEquals( true, is_array( $jobs[9]->params['range'] ), 'Last job is recursive sub-job' ); - $this->assertEquals( $title->getPrefixedText(), $jobs[0]->getTitle()->getPrefixedText(), + $this->assertEquals( $title->getPrefixedText(), $jobs[0]->getTitle()->getPrefixedText(), 'Base job title retainend in leaf job' ); - $this->assertEquals( $title->getPrefixedText(), $jobs[9]->getTitle()->getPrefixedText(), + $this->assertEquals( $title->getPrefixedText(), $jobs[9]->getTitle()->getPrefixedText(), 'Base job title retainend recursive sub-job' ); $this->assertEquals( $extraParams['rootJobSignature'], $jobs[0]->params['rootJobSignature'], 'Leaf job has root params' ); - $this->assertEquals( $extraParams['rootJobSignature'], $jobs[9]->params['rootJobSignature'], + $this->assertEquals( $extraParams['rootJobSignature'], $jobs[9]->params['rootJobSignature'], 'Recursive sub-job has root params' ); $jobs2 = BacklinkJobUtils::partitionBacklinkJob( $jobs[9], 9, 1, array( 'params' => $extraParams ) ); $this->assertEquals( 10, count( $jobs2 ), 'Correct number of sub-jobs' ); - $this->assertEquals( $pages[9], current( $jobs2[0]->params['pages'] ), + $this->assertEquals( $pages[9], current( $jobs2[0]->params['pages'] ), 'First job is leaf job with proper title' ); $this->assertEquals( $pages[17], current( $jobs2[8]->params['pages'] ), 'Last leaf job is leaf job with proper title' ); @@ -73,17 +73,17 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase { 'Last job is recursive sub-job' ); $this->assertEquals( $extraParams['rootJobSignature'], $jobs2[0]->params['rootJobSignature'], 'Leaf job has root params' ); - $this->assertEquals( $extraParams['rootJobSignature'], $jobs2[9]->params['rootJobSignature'], + $this->assertEquals( $extraParams['rootJobSignature'], $jobs2[9]->params['rootJobSignature'], 'Recursive sub-job has root params' ); $jobs3 = BacklinkJobUtils::partitionBacklinkJob( $jobs2[9], 9, 1, array( 'params' => $extraParams ) ); $this->assertEquals( 2, count( $jobs3 ), 'Correct number of sub-jobs' ); - $this->assertEquals( $pages[18], current( $jobs3[0]->params['pages'] ), + $this->assertEquals( $pages[18], current( $jobs3[0]->params['pages'] ), 'First job is leaf job with proper title' ); $this->assertEquals( $extraParams['rootJobSignature'], $jobs3[0]->params['rootJobSignature'], 'Leaf job has root params' ); - $this->assertEquals( $pages[19], current( $jobs3[1]->params['pages'] ), + $this->assertEquals( $pages[19], current( $jobs3[1]->params['pages'] ), 'Last job is leaf job with proper title' ); $this->assertEquals( $extraParams['rootJobSignature'], $jobs3[1]->params['rootJobSignature'], 'Last leaf job has root params' ); @@ -91,7 +91,7 @@ class RefreshLinksPartitionTest extends MediaWikiTestCase { public static function provider_backlinks() { $pages = array(); - for ( $i=0; $i<20; ++$i ) { + for ( $i = 0; $i < 20; ++$i ) { $pages[] = array( 0, "Page-$i" ); } return array( diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index 17e883fd79..4ccf5d78bb 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -46,12 +46,12 @@ class SpecialSearchTest extends MediaWikiTestCase { array( /** Expected: */ 'ProfileName' => $expectedProfile, 'Namespaces' => $expectedNS, - ) - , array( /** Actual: */ + ), + array( /** Actual: */ 'ProfileName' => $search->getProfile(), 'Namespaces' => $search->getNamespaces(), - ) - , $message + ), + $message ); } -- 2.20.1