From: Tim Starling Date: Tue, 31 May 2011 05:55:06 +0000 (+0000) Subject: Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be readable... X-Git-Tag: 1.31.0-rc.0~29831 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=c00d63dda3df84fd728dc21ffe8bab8060d76ebc;p=lhc%2Fweb%2Fwiklou.git Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be readable again. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 628a56ec82..b25e37fc82 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3823,7 +3823,7 @@ $wgDebugLogPrefix = ''; $wgDebugRedirects = false; /** - * If true, log debugging data from action=raw. + * If true, log debugging data from action=raw and load.php. * This is normally false to avoid overlapping debug entries due to gen=css and * gen=js requests. */ diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 17f9350b2c..6ce6271591 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -331,8 +331,7 @@ function wfDebug( $text, $logonly = false ) { static $cache = array(); // Cache of unoutputted messages $text = wfDebugTimer() . $text; - # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet - if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) { + if ( !$wgDebugRawPage && wfIsDebugRawPage() ) { return; } @@ -356,6 +355,28 @@ function wfDebug( $text, $logonly = false ) { } } +/** + * Returns true if debug logging should be suppressed if $wgDebugRawPage = false + */ +function wfIsDebugRawPage() { + static $cache; + if ( $cache !== null ) { + return $cache; + } + # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet + if ( ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' ) + || ( + isset( $_SERVER['SCRIPT_NAME'] ) + && substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php' + ) ) + { + $cache = true; + } else { + $cache = false; + } + return $cache; +} + /** * Get microsecond timestamps for debug logs * @@ -523,7 +544,7 @@ function wfLogProfilingData() { $profiler->logData(); // Check whether this should be logged in the debug file. - if ( $wgDebugLogFile == '' || ( $wgRequest->getVal( 'action' ) == 'raw' && !$wgDebugRawPage ) ) { + if ( $wgDebugLogFile == '' || ( !$wgDebugRawPage && wfIsDebugRawPage() ) ) { return; }