From 8d701eeeeac58df2ff15df91d54da5a8cac4e15e Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 4 Feb 2014 22:16:13 +0100 Subject: [PATCH] Remove trailing line breaks from wfDebugLog() messages This is useless since the message is passed through trim() and a line break is added afterwards. Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c --- includes/Exception.php | 2 +- includes/GlobalFunctions.php | 4 ++-- includes/SquidPurgeClient.php | 2 +- includes/User.php | 4 ++-- includes/WikiPage.php | 4 ++-- includes/cache/LocalisationCache.php | 2 +- includes/clientpool/RedisConnectionPool.php | 4 ++-- includes/db/LoadBalancer.php | 14 +++++++------- includes/deferred/SquidUpdate.php | 8 ++++---- includes/externalstore/ExternalStoreDB.php | 14 +++++++------- includes/media/Exif.php | 12 ++++++------ includes/objectcache/RedisBagOStuff.php | 2 +- includes/upload/UploadFromChunks.php | 4 ++-- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/includes/Exception.php b/includes/Exception.php index be2e13f08e..45b314d733 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -901,7 +901,7 @@ class MWExceptionHandler { if ( !( $e instanceof MWException ) || $e->isLoggable() ) { $log = self::getLogMessage( $e ); if ( $wgLogExceptionBacktrace ) { - wfDebugLog( 'exception', $log . "\n" . $e->getTraceAsString() . "\n" ); + wfDebugLog( 'exception', $log . "\n" . $e->getTraceAsString() ); } else { wfDebugLog( 'exception', $log ); } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 90bc4bb63e..6785d0c940 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2868,7 +2868,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $pipes = null; $proc = proc_open( $cmd, $desc, $pipes ); if ( !$proc ) { - wfDebugLog( 'exec', "proc_open() failed: $cmd\n" ); + wfDebugLog( 'exec', "proc_open() failed: $cmd" ); $retval = -1; return ''; } @@ -2983,7 +2983,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), } if ( $logMsg !== false ) { - wfDebugLog( 'exec', "$logMsg: $cmd\n" ); + wfDebugLog( 'exec', "$logMsg: $cmd" ); } return $outBuffer; diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index f5fd195085..eadf2563e3 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -373,7 +373,7 @@ class SquidPurgeClient { * @param $msg string */ protected function log( $msg ) { - wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg\n" ); + wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg" ); } } diff --git a/includes/User.php b/includes/User.php index a762cd0c07..d863a06bdc 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1418,11 +1418,11 @@ class User { $ipList = gethostbynamel( $host ); if ( $ipList ) { - wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" ); + wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!" ); $found = true; break; } else { - wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base.\n" ); + wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base." ); } } } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 99a70d9061..a191983d42 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -3608,12 +3608,12 @@ class PoolWorkArticleView extends PoolCounterWork { $this->parserOutput = ParserCache::singleton()->getDirty( $this->page, $this->parserOptions ); if ( $this->parserOutput === false ) { - wfDebugLog( 'dirty', "dirty missing\n" ); + wfDebugLog( 'dirty', 'dirty missing' ); wfDebug( __METHOD__ . ": no dirty cache\n" ); return false; } else { wfDebug( __METHOD__ . ": sending dirty output\n" ); - wfDebugLog( 'dirty', "dirty output {$this->cacheKey}\n" ); + wfDebugLog( 'dirty', "dirty output {$this->cacheKey}" ); $this->isDirty = true; return true; } diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 9047a47c07..915a43e7e2 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -575,7 +575,7 @@ class LocalisationCache { try { $compiledRules = CLDRPluralRuleEvaluator::compile( $rules ); } catch ( CLDRPluralRuleError $e ) { - wfDebugLog( 'l10n', $e->getMessage() . "\n" ); + wfDebugLog( 'l10n', $e->getMessage() ); return array(); } diff --git a/includes/clientpool/RedisConnectionPool.php b/includes/clientpool/RedisConnectionPool.php index 8a6718f8f0..983d90a25b 100644 --- a/includes/clientpool/RedisConnectionPool.php +++ b/includes/clientpool/RedisConnectionPool.php @@ -210,7 +210,7 @@ class RedisConnectionPool { } } catch ( RedisException $e ) { $this->downServers[$server] = time() + self::SERVER_DOWN_TTL; - wfDebugLog( 'redis', "Redis exception connecting to $server: " . $e->getMessage() . "\n" ); + wfDebugLog( 'redis', "Redis exception connecting to $server: " . $e->getMessage() ); return false; } @@ -279,7 +279,7 @@ class RedisConnectionPool { * @param RedisException $e */ public function handleException( $server, RedisConnRef $cref, RedisException $e ) { - wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() . "\n" ); + wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() ); foreach ( $this->connections[$server] as $key => $connection ) { if ( $cref->isConnIdentical( $connection['conn'] ) ) { $this->idlePoolSize -= $connection['free'] ? 1 : 0; diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index c622afe8f5..e35c4c4903 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -144,10 +144,10 @@ class LoadBalancer { foreach ( $lags as $i => $lag ) { if ( $i != 0 ) { if ( $lag === false ) { - wfDebugLog( 'replication', "Server #$i is not replicating\n" ); + wfDebugLog( 'replication', "Server #$i is not replicating" ); unset( $loads[$i] ); } elseif ( isset( $this->mServers[$i]['max lag'] ) && $lag > $this->mServers[$i]['max lag'] ) { - wfDebugLog( 'replication', "Server #$i is excessively lagged ($lag seconds)\n" ); + wfDebugLog( 'replication', "Server #$i is excessively lagged ($lag seconds)" ); unset( $loads[$i] ); } } @@ -240,7 +240,7 @@ class LoadBalancer { $i = $this->getRandomNonLagged( $currentLoads, $wiki ); if ( $i === false && count( $currentLoads ) != 0 ) { # All slaves lagged. Switch to read-only mode - wfDebugLog( 'replication', "All slaves lagged. Switch to read-only mode\n" ); + wfDebugLog( 'replication', "All slaves lagged. Switch to read-only mode" ); $wgReadOnly = 'The database has been automatically locked ' . 'while the slave database servers catch up to the master'; $i = ArrayUtils::pickRandom( $currentLoads ); @@ -252,17 +252,17 @@ class LoadBalancer { # pickRandom() returned false # This is permanent and means the configuration or the load monitor # wants us to return false. - wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false\n" ); + wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false" ); return false; } wfDebugLog( 'connect', __METHOD__ . - ": Using reader #$i: {$this->mServers[$i]['host']}...\n" ); + ": Using reader #$i: {$this->mServers[$i]['host']}..." ); $conn = $this->openConnection( $i, $wiki ); if ( !$conn ) { - wfDebugLog( 'connect', __METHOD__ . ": Failed connecting to $i/$wiki\n" ); + wfDebugLog( 'connect', __METHOD__ . ": Failed connecting to $i/$wiki" ); unset( $nonErrorLoads[$i] ); unset( $currentLoads[$i] ); continue; @@ -280,7 +280,7 @@ class LoadBalancer { # If all servers were down, quit now if ( !count( $nonErrorLoads ) ) { - wfDebugLog( 'connect', "All servers down\n" ); + wfDebugLog( 'connect', "All servers down" ); } if ( $i !== false ) { diff --git a/includes/deferred/SquidUpdate.php b/includes/deferred/SquidUpdate.php index 85592e87bd..0dcff44a7d 100644 --- a/includes/deferred/SquidUpdate.php +++ b/includes/deferred/SquidUpdate.php @@ -139,7 +139,7 @@ class SquidUpdate { return; } - wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) . "\n" ); + wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) ); if ( $wgHTCPRouting ) { self::HTCPPurge( $urlArr ); @@ -200,7 +200,7 @@ class SquidUpdate { if ( !$conn ) { $errstr = socket_strerror( socket_last_error() ); wfDebugLog( 'squid', __METHOD__ . - ": Error opening UDP socket: $errstr\n" ); + ": Error opening UDP socket: $errstr" ); wfProfileOut( __METHOD__ ); return; @@ -230,7 +230,7 @@ class SquidUpdate { $conf = self::getRuleForURL( $url, $wgHTCPRouting ); if ( !$conf ) { wfDebugLog( 'squid', __METHOD__ . - "No HTCP rule configured for URL {$url} , skipping\n" ); + "No HTCP rule configured for URL {$url} , skipping" ); continue; } @@ -266,7 +266,7 @@ class SquidUpdate { $htcpTransID, $htcpSpecifier, 2 ); wfDebugLog( 'squid', __METHOD__ . - "Purging URL $url via HTCP\n" ); + "Purging URL $url via HTCP" ); foreach ( $conf as $subconf ) { socket_sendto( $conn, $htcpPacket, $htcpLen, 0, $subconf['host'], $subconf['port'] ); diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index b7e5469272..5e7b32389c 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -187,27 +187,27 @@ class ExternalStoreDB extends ExternalStoreMedium { $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/"; if ( isset( $externalBlobCache[$cacheID] ) ) { wfDebugLog( 'ExternalStoreDB-cache', - "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" ); + "ExternalStoreDB::fetchBlob cache hit on $cacheID" ); return $externalBlobCache[$cacheID]; } wfDebugLog( 'ExternalStoreDB-cache', - "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" ); + "ExternalStoreDB::fetchBlob cache miss on $cacheID" ); $dbr = $this->getSlave( $cluster ); $ret = $dbr->selectField( $this->getTable( $dbr ), 'blob_text', array( 'blob_id' => $id ), __METHOD__ ); if ( $ret === false ) { wfDebugLog( 'ExternalStoreDB', - "ExternalStoreDB::fetchBlob master fallback on $cacheID\n" ); + "ExternalStoreDB::fetchBlob master fallback on $cacheID" ); // Try the master $dbw = $this->getMaster( $cluster ); $ret = $dbw->selectField( $this->getTable( $dbw ), 'blob_text', array( 'blob_id' => $id ), __METHOD__ ); if ( $ret === false ) { wfDebugLog( 'ExternalStoreDB', - "ExternalStoreDB::fetchBlob master failed to find $cacheID\n" ); + "ExternalStoreDB::fetchBlob master failed to find $cacheID" ); } } if ( $itemID !== false && $ret !== false ) { @@ -239,7 +239,7 @@ class ExternalStoreDB extends ExternalStoreMedium { if ( $ids ) { wfDebugLog( __CLASS__, __METHOD__ . " master fallback on '$cluster' for: " . - implode( ',', array_keys( $ids ) ) . "\n" ); + implode( ',', array_keys( $ids ) ) ); // Try the master $dbw = $this->getMaster( $cluster ); $res = $dbw->select( $this->getTable( $dbr ), @@ -247,7 +247,7 @@ class ExternalStoreDB extends ExternalStoreMedium { array( 'blob_id' => array_keys( $ids ) ), __METHOD__ ); if ( $res === false ) { - wfDebugLog( __CLASS__, __METHOD__ . " master failed on '$cluster'\n" ); + wfDebugLog( __CLASS__, __METHOD__ . " master failed on '$cluster'" ); } else { $this->mergeBatchResult( $ret, $ids, $res ); } @@ -255,7 +255,7 @@ class ExternalStoreDB extends ExternalStoreMedium { if ( $ids ) { wfDebugLog( __CLASS__, __METHOD__ . " master on '$cluster' failed locating items: " . - implode( ',', array_keys( $ids ) ) . "\n" ); + implode( ',', array_keys( $ids ) ) ); } return $ret; diff --git a/includes/media/Exif.php b/includes/media/Exif.php index 844aef2684..1cb5542b74 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -829,13 +829,13 @@ class Exif { } if ( $action === true ) { - wfDebugLog( $this->log, "$class::$fname: accepted: '$in' (type: $type)\n" ); + wfDebugLog( $this->log, "$class::$fname: accepted: '$in' (type: $type)" ); } elseif ( $action === false ) { - wfDebugLog( $this->log, "$class::$fname: rejected: '$in' (type: $type)\n" ); + wfDebugLog( $this->log, "$class::$fname: rejected: '$in' (type: $type)" ); } elseif ( $action === null ) { - wfDebugLog( $this->log, "$class::$fname: input was: '$in' (type: $type)\n" ); + wfDebugLog( $this->log, "$class::$fname: input was: '$in' (type: $type)" ); } else { - wfDebugLog( $this->log, "$class::$fname: $action (type: $type; content: '$in')\n" ); + wfDebugLog( $this->log, "$class::$fname: $action (type: $type; content: '$in')" ); } } @@ -851,9 +851,9 @@ class Exif { } $class = ucfirst( __CLASS__ ); if ( $io ) { - wfDebugLog( $this->log, "$class::$fname: begin processing: '{$this->basename}'\n" ); + wfDebugLog( $this->log, "$class::$fname: begin processing: '{$this->basename}'" ); } else { - wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'\n" ); + wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'" ); } } } diff --git a/includes/objectcache/RedisBagOStuff.php b/includes/objectcache/RedisBagOStuff.php index 3c97480f86..56f21283aa 100644 --- a/includes/objectcache/RedisBagOStuff.php +++ b/includes/objectcache/RedisBagOStuff.php @@ -343,7 +343,7 @@ class RedisBagOStuff extends BagOStuff { * Log a fatal error */ protected function logError( $msg ) { - wfDebugLog( 'redis', "Redis error: $msg\n" ); + wfDebugLog( 'redis', "Redis error: $msg" ); } /** diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index b572499783..bdcc9a1c45 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -139,7 +139,7 @@ class UploadFromChunks extends UploadFromFile { if ( !$status->isOk() ) { return $status; } - wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds.\n" ); + wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds." ); // File system path $this->mTempPath = $tmpPath; @@ -158,7 +158,7 @@ class UploadFromChunks extends UploadFromFile { $this->mLocalFile = parent::stashFile( $this->user ); $tAmount = microtime( true ) - $tStart; $this->mLocalFile->setLocalReference( $tmpFile ); // reuse (e.g. for getImageInfo()) - wfDebugLog( 'fileconcatenate', "Stashed combined file ($i chunks) in $tAmount seconds.\n" ); + wfDebugLog( 'fileconcatenate', "Stashed combined file ($i chunks) in $tAmount seconds." ); return $status; } -- 2.20.1