https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113647

Revision: 113647
Author:   ialex
Date:     2012-03-12 19:01:44 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
* Put the timer stuff after leading line breaks in debug log entries (mainly 
for the first call on a request) so that they are placed near the remaing text 
and not on its own line
* Normalise line breaks in the first entry on a web request so that it's 
consistent with the one for command line requests

Modified Paths:
--------------
    trunk/phase3/includes/GlobalFunctions.php
    trunk/phase3/includes/Setup.php

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2012-03-12 18:26:50 UTC (rev 
113646)
+++ trunk/phase3/includes/GlobalFunctions.php   2012-03-12 19:01:44 UTC (rev 
113647)
@@ -876,12 +876,16 @@
        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;
 

Modified: trunk/phase3/includes/Setup.php
===================================================================
--- trunk/phase3/includes/Setup.php     2012-03-12 18:26:50 UTC (rev 113646)
+++ trunk/phase3/includes/Setup.php     2012-03-12 19:01:44 UTC (rev 113647)
@@ -421,16 +421,16 @@
        # 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' );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to