http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89205

Revision: 89205
Author:   tstarling
Date:     2011-05-31 05:55:06 +0000 (Tue, 31 May 2011)
Log Message:
-----------
Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be 
readable again.

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

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2011-05-31 05:50:48 UTC (rev 
89204)
+++ trunk/phase3/includes/DefaultSettings.php   2011-05-31 05:55:06 UTC (rev 
89205)
@@ -3823,7 +3823,7 @@
 $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.
  */

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2011-05-31 05:50:48 UTC (rev 
89204)
+++ trunk/phase3/includes/GlobalFunctions.php   2011-05-31 05:55:06 UTC (rev 
89205)
@@ -331,8 +331,7 @@
        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;
        }
 
@@ -357,6 +356,28 @@
 }
 
 /**
+ * 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
  * 
  * @return string
@@ -523,7 +544,7 @@
        $profiler->logData();
 
        // Check whether this should be logged in the debug file.
-       if ( $wgDebugLogFile == '' || ( $wgRequest->getVal( 'action' ) == 'raw' 
&& !$wgDebugRawPage ) ) {
+       if ( $wgDebugLogFile == '' || ( !$wgDebugRawPage && wfIsDebugRawPage() 
) ) {
                return;
        }
 


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

Reply via email to