From 7006e1df9309f7dc1f311e9025b3641f7bdf9a8b Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 30 Jan 2013 15:03:58 +0100 Subject: [PATCH] style: fix up commas in function arguments Fix up spaces in our function calls, we do not want spaces before a comma and try to avoid multiple commas whenever possible. Errors: * No space found after comma in function call * Space found before comma in function call Change-Id: I51aec02016f742422fa60b92ad35ba3f0ef59ba3 --- img_auth.php | 2 +- includes/Defines.php | 2 +- includes/IP.php | 4 +++- includes/MimeMagic.php | 2 +- includes/normal/UtfNormal.php | 4 ++-- languages/Language.php | 2 +- maintenance/Maintenance.php | 2 +- maintenance/backupPrefetch.inc | 4 ++-- maintenance/changePassword.php | 2 +- maintenance/lag.php | 4 ++-- maintenance/language/languages.inc | 2 +- maintenance/mwdocgen.php | 2 +- maintenance/purgeList.php | 2 +- maintenance/refreshImageMetadata.php | 2 +- maintenance/showStats.php | 2 +- opensearch_desc.php | 2 +- profileinfo.php | 4 ++-- 17 files changed, 23 insertions(+), 21 deletions(-) diff --git a/img_auth.php b/img_auth.php index b04974bf82..2f7fb39050 100644 --- a/img_auth.php +++ b/img_auth.php @@ -106,7 +106,7 @@ function wfImageAuthMain() { // Check to see if the file exists if ( !$repo->fileExists( $filename ) ) { - wfForbidden( 'img-auth-accessdenied','img-auth-nofile', $filename ); + wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename ); return; } diff --git a/includes/Defines.php b/includes/Defines.php index 882f318245..46b0947a5b 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -227,7 +227,7 @@ define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 ); define( 'OT_HTML', 1 ); define( 'OT_WIKI', 2 ); define( 'OT_PREPROCESS', 3 ); -define( 'OT_MSG' , 3 ); // b/c alias for OT_PREPROCESS +define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS define( 'OT_PLAIN', 4 ); /**@}*/ diff --git a/includes/IP.php b/includes/IP.php index 1b40f4bc1a..5c50c22f44 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -714,7 +714,9 @@ class IP { * @return String: valid dotted quad IPv4 address or null */ public static function canonicalize( $addr ) { - $addr = preg_replace( '/\%.*/','', $addr ); // remove zone info (bug 35738) + // remove zone info (bug 35738) + $addr = preg_replace( '/\%.*/', '', $addr ); + if ( self::isValid( $addr ) ) { return $addr; } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 108ba1dbbc..5b884805e6 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -39,7 +39,7 @@ * appending MM_WELL_KNOWN_MIME_TYPES behind $wgMimeTypeFile, but who knows * what will break? In practice this probably isn't a problem anyway -- Bryan) */ -define('MM_WELL_KNOWN_MIME_TYPES',<< 1 ) { // use the last pattern for the rest of the number diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 2a8b8e5099..b2bbf9b7b7 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -920,7 +920,7 @@ abstract class Maintenance { if ( !is_readable( $settingsFile ) ) { $this->error( "A copy of your installation's LocalSettings.php\n" . "must exist and be readable in the source directory.\n" . - "Use --conf to specify it." , true ); + "Use --conf to specify it.", true ); } $wgCommandLineMode = true; return $settingsFile; diff --git a/maintenance/backupPrefetch.inc b/maintenance/backupPrefetch.inc index 0e12a1ce49..cc0a7e170c 100644 --- a/maintenance/backupPrefetch.inc +++ b/maintenance/backupPrefetch.inc @@ -48,9 +48,9 @@ class BaseDump { var $infiles = null; function BaseDump( $infile ) { - $this->infiles = explode(';',$infile); + $this->infiles = explode( ';', $infile ); $this->reader = new XMLReader(); - $infile = array_shift($this->infiles); + $infile = array_shift( $this->infiles ); if (defined( 'LIBXML_PARSEHUGE' ) ) { $this->reader->open( $infile, null, LIBXML_PARSEHUGE ); } diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index f276fc1637..861610b714 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -46,7 +46,7 @@ class ChangePassword extends Maintenance { } elseif ( $this->hasOption( "userid" ) ) { $user = User::newFromId( $this->getOption( 'userid' ) ); } else { - $this->error( "A \"user\" or \"userid\" must be set to change the password for" , true ); + $this->error( "A \"user\" or \"userid\" must be set to change the password for", true ); } if ( !$user || !$user->getId() ) { $this->error( "No such user: " . $this->getOption( 'user' ), true ); diff --git a/maintenance/lag.php b/maintenance/lag.php index 3ad0864fb9..3df1169296 100644 --- a/maintenance/lag.php +++ b/maintenance/lag.php @@ -51,7 +51,7 @@ class DatabaseLag extends Maintenance { unset( $lags[0] ); echo gmdate( 'H:i:s' ) . ' '; foreach ( $lags as $lag ) { - printf( "%-12s " , $lag === false ? 'false' : $lag ); + printf( "%-12s ", $lag === false ? 'false' : $lag ); } echo "\n"; sleep( 5 ); @@ -61,7 +61,7 @@ class DatabaseLag extends Maintenance { $lags = $lb->getLagTimes(); foreach ( $lags as $i => $lag ) { $name = $lb->getServerName( $i ); - $this->output( sprintf( "%-20s %s\n" , $name, $lag === false ? 'false' : $lag ) ); + $this->output( sprintf( "%-20s %s\n", $name, $lag === false ? 'false' : $lag ) ); } } } diff --git a/maintenance/language/languages.inc b/maintenance/language/languages.inc index b1c16adfae..420e8427c6 100644 --- a/maintenance/language/languages.inc +++ b/maintenance/language/languages.inc @@ -508,7 +508,7 @@ class languages { if ( isset( $messages[$key] ) ) { - $messages[$key] = implode( $messages[$key],", " ); + $messages[$key] = implode( $messages[$key], ", " ); } } return $messages; diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php index 429e3b3ef8..5e505eba57 100644 --- a/maintenance/mwdocgen.php +++ b/maintenance/mwdocgen.php @@ -131,7 +131,7 @@ function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, ); $tmpCfg = str_replace( array_keys( $replacements ), array_values( $replacements ), $template ); $tmpFileName = tempnam( wfTempDir(), 'mwdocgen-' ); - file_put_contents( $tmpFileName , $tmpCfg ) or die( "Could not write doxygen configuration to file $tmpFileName\n" ); + file_put_contents( $tmpFileName, $tmpCfg ) or die( "Could not write doxygen configuration to file $tmpFileName\n" ); return $tmpFileName; } diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index 58fe880148..850d032f65 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -32,7 +32,7 @@ class PurgeList extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Send purge requests for listed pages to squid"; - $this->addOption( 'purge', 'Whether to update page_touched.' , false, false ); + $this->addOption( 'purge', 'Whether to update page_touched.', false, false ); $this->addOption( 'namespace', 'Namespace number', false, true ); $this->setBatchSize( 100 ); } diff --git a/maintenance/refreshImageMetadata.php b/maintenance/refreshImageMetadata.php index 12da7a8bc1..55f5b4aa8c 100644 --- a/maintenance/refreshImageMetadata.php +++ b/maintenance/refreshImageMetadata.php @@ -53,7 +53,7 @@ class RefreshImageMetadata extends Maintenance { $this->addOption( 'start', 'Name of file to start with', false, true ); $this->addOption( 'end', 'Name of file to end with', false, true ); - $this->addOption( 'mime', '(Inefficient!) Only refresh files with this mime type. Can accept wild-card image/*' , false, true ); + $this->addOption( 'mime', '(Inefficient!) Only refresh files with this mime type. Can accept wild-card image/*', false, true ); $this->addOption( 'metadata-contains', '(Inefficient!) Only refresh files where the img_metadata field contains this string. Can be used if its known a specific property was being extracted incorrectly.', false, true ); } diff --git a/maintenance/showStats.php b/maintenance/showStats.php index 657c056325..3036406123 100644 --- a/maintenance/showStats.php +++ b/maintenance/showStats.php @@ -59,7 +59,7 @@ class ShowStats extends Maintenance { $max_length_value = $max_length_desc = 0; foreach ( $fields as $field => $desc ) { $max_length_value = max( $max_length_value, strlen( $stats->$field ) ); - $max_length_desc = max( $max_length_desc , strlen( $desc ) ) ; + $max_length_desc = max( $max_length_desc, strlen( $desc ) ) ; } // Show them diff --git a/opensearch_desc.php b/opensearch_desc.php index 95f028ac73..4e8a1a2eb8 100644 --- a/opensearch_desc.php +++ b/opensearch_desc.php @@ -65,7 +65,7 @@ print Xml::element( 'Image', 'height' => 16, 'width' => 16, 'type' => 'image/x-icon' ), - wfExpandUrl( $wgFavicon , PROTO_CURRENT ) ); + wfExpandUrl( $wgFavicon, PROTO_CURRENT ) ); $urls = array(); diff --git a/profileinfo.php b/profileinfo.php index cbbf2abdaf..885a9e9f44 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -221,9 +221,9 @@ class profile_point { count(); ?> callsPerRequest() ), 2 ); ?> timePerCall() ), 2 ); ?> - memoryPerCall() / 1024 ), 2 ); ?> + memoryPerCall() / 1024 ), 2 ); ?> time() / self::$totalcount ), 2 ); ?> - memory() / self::$totalcount / 1024 ), 2 ); ?> + memory() / self::$totalcount / 1024 ), 2 ); ?>