r35991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35990‎ | r35991 | r35992 >
Date:12:57, 7 June 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Cache debug messages until $wgOut is initialised
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -176,12 +176,16 @@
177177 global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
178178 static $recursion = 0;
179179
 180+ static $cache = array(); // Cache of unoutputted messages
 181+
180182 # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
181183 if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
182184 return;
183185 }
184186
185187 if ( $wgDebugComments && !$logonly ) {
 188+ $cache[] = $text;
 189+
186190 if ( !isset( $wgOut ) ) {
187191 return;
188192 }
@@ -193,7 +197,10 @@
194198 $wgOut->_unstub();
195199 $recursion--;
196200 }
197 - $wgOut->debug( $text );
 201+
 202+ // add the message and possible cached ones to the output
 203+ array_map( array( $wgOut, 'debug' ), $cache );
 204+ $cache = array();
198205 }
199206 if ( '' != $wgDebugLogFile && !$wgProfileOnly ) {
200207 # Strip unprintables; they can switch terminal modes when binary data

Status & tagging log