* Put the timer stuff after leading line breaks in debug log entries (mainly for...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 12 Mar 2012 19:01:44 +0000 (19:01 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 12 Mar 2012 19:01:44 +0000 (19:01 +0000)
* Normalise line breaks in the first entry on a web request so that it's consistent with the one for command line requests

includes/GlobalFunctions.php
includes/Setup.php

index ce9c287..2a81c9a 100644 (file)
@@ -876,12 +876,16 @@ function wfDebug( $text, $logonly = false ) {
        global $wgDebugLogPrefix, $wgShowDebug;
 
        static $cache = array(); // Cache of unoutputted messages
-       $text = wfDebugTimer() . $text;
 
        if ( !$wgDebugRawPage && wfIsDebugRawPage() ) {
                return;
        }
 
+       $timer = wfDebugTimer();
+       if ( $timer !== '' ) {
+               $text = preg_replace( '/[^\n]/', $timer . '\0', $text, 1 );
+       }
+
        if ( ( $wgDebugComments || $wgShowDebug ) && !$logonly ) {
                $cache[] = $text;
 
index b858dba..d0ce209 100644 (file)
@@ -421,16 +421,16 @@ if ( $wgCommandLineMode ) {
        # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
        $wgRequest = new WebRequest;
 
-       $debug = "Start request\n\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}";
+       $debug = "\n\nStart request\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}\n";
 
        if ( $wgDebugPrintHttpHeaders ) {
-               $debug .= "\nHTTP HEADERS:\n";
+               $debug .= "HTTP HEADERS:\n";
 
                foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
                        $debug .= "$name: $value\n";
                }
        }
-       wfDebug( "$debug\n" );
+       wfDebug( $debug );
 }
 
 wfProfileOut( $fname . '-misc1' );