r89205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89204‎ | r89205 | r89206 >
Date:05:55, 31 May 2011
Author:tstarling
Status:ok
Tags:
Comment:
Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be readable again.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -331,8 +331,7 @@
332332 static $cache = array(); // Cache of unoutputted messages
333333 $text = wfDebugTimer() . $text;
334334
335 - # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
336 - if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
 335+ if ( !$wgDebugRawPage && wfIsDebugRawPage() ) {
337336 return;
338337 }
339338
@@ -357,6 +356,28 @@
358357 }
359358
360359 /**
 360+ * Returns true if debug logging should be suppressed if $wgDebugRawPage = false
 361+ */
 362+function wfIsDebugRawPage() {
 363+ static $cache;
 364+ if ( $cache !== null ) {
 365+ return $cache;
 366+ }
 367+ # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
 368+ if ( ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' )
 369+ || (
 370+ isset( $_SERVER['SCRIPT_NAME'] )
 371+ && substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php'
 372+ ) )
 373+ {
 374+ $cache = true;
 375+ } else {
 376+ $cache = false;
 377+ }
 378+ return $cache;
 379+}
 380+
 381+/**
361382 * Get microsecond timestamps for debug logs
362383 *
363384 * @return string
@@ -523,7 +544,7 @@
524545 $profiler->logData();
525546
526547 // Check whether this should be logged in the debug file.
527 - if ( $wgDebugLogFile == '' || ( $wgRequest->getVal( 'action' ) == 'raw' && !$wgDebugRawPage ) ) {
 548+ if ( $wgDebugLogFile == '' || ( !$wgDebugRawPage && wfIsDebugRawPage() ) ) {
528549 return;
529550 }
530551
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3823,7 +3823,7 @@
38243824 $wgDebugRedirects = false;
38253825
38263826 /**
3827 - * If true, log debugging data from action=raw.
 3827+ * If true, log debugging data from action=raw and load.php.
38283828 * This is normally false to avoid overlapping debug entries due to gen=css and
38293829 * gen=js requests.
38303830 */

Sign-offs

UserFlagDate
Nikerabbitinspected12:46, 14 June 2011

Status & tagging log