r61653 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61652‎ | r61653 | r61654 >
Date:04:29, 29 January 2010
Author:tstarling
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -183,25 +183,25 @@
184184 } else {
185185 wfDebug( "Start request\n\n" );
186186 wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
187 - $header_out = "HTTP HEADERS:\n";
188187
189 - if ( function_exists( 'getallheaders' ) ) {
190 - $headers = getallheaders();
191 - foreach ( $headers as $name => $value ) {
192 - $header_out .= "$name: $value\n";
 188+ if ( $wgDebugPrintHttpHeaders ) {
 189+ $headerOut = "HTTP HEADERS:\n";
 190+
 191+ if ( function_exists( 'getallheaders' ) ) {
 192+ $headers = getallheaders();
 193+ foreach ( $headers as $name => $value ) {
 194+ $headerOut .= "$name: $value\n";
 195+ }
 196+ } else {
 197+ $headers = $_SERVER;
 198+ foreach ( $headers as $name => $value ) {
 199+ if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue;
 200+ $name = substr( $name, 5 );
 201+ $headerOut .= "$name: $value\n";
 202+ }
193203 }
194 - } else {
195 - $headers = $_SERVER;
196 - foreach ( $headers as $name => $value ) {
197 - if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue;
198 - $name = substr( $name, 5 );
199 - $header_out .= "$name: $value\n";
200 - }
 204+ wfDebug( "$headerOut\n" );
201205 }
202 -
203 - if ( $wgDebugPrintHttpHeaders ) {
204 - wfDebug( "$header_out\n" );
205 - }
206206 }
207207
208208 if( $wgRCFilterByAge ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61582New configuration variables $wgDebugTimestamps and $wgDebugPrintHttpHeaders f...nikerabbit17:21, 27 January 2010

Status & tagging log