From: Tim Starling Date: Fri, 29 Jan 2010 04:29:26 +0000 (+0000) Subject: Fix for r61582: if $wgDebugPrintHttpHeaders is false, don't construct the header... X-Git-Tag: 1.31.0-rc.0~38062 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=07b4b0b3fc3eccc4447d57b7befe7f7149164e5e;p=lhc%2Fweb%2Fwiklou.git Fix for r61582: if $wgDebugPrintHttpHeaders is false, don't construct the header string and then throw it away, skip the whole code block and save a few microseconds. --- diff --git a/includes/Setup.php b/includes/Setup.php index 564226667e..cd9146ab9d 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -183,24 +183,24 @@ if ( $wgCommandLineMode ) { } else { wfDebug( "Start request\n\n" ); wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" ); - $header_out = "HTTP HEADERS:\n"; - - if ( function_exists( 'getallheaders' ) ) { - $headers = getallheaders(); - foreach ( $headers as $name => $value ) { - $header_out .= "$name: $value\n"; - } - } else { - $headers = $_SERVER; - foreach ( $headers as $name => $value ) { - if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue; - $name = substr( $name, 5 ); - $header_out .= "$name: $value\n"; - } - } if ( $wgDebugPrintHttpHeaders ) { - wfDebug( "$header_out\n" ); + $headerOut = "HTTP HEADERS:\n"; + + if ( function_exists( 'getallheaders' ) ) { + $headers = getallheaders(); + foreach ( $headers as $name => $value ) { + $headerOut .= "$name: $value\n"; + } + } else { + $headers = $_SERVER; + foreach ( $headers as $name => $value ) { + if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue; + $name = substr( $name, 5 ); + $headerOut .= "$name: $value\n"; + } + } + wfDebug( "$headerOut\n" ); } }