r78176 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78175‎ | r78176 | r78177 >
Date:12:03, 10 December 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Don't unstub $wgOut just for adding debug messages
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -297,7 +297,6 @@
298298 function wfDebug( $text, $logonly = false ) {
299299 global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
300300 global $wgDebugLogPrefix, $wgShowDebug;
301 - static $recursion = 0;
302301
303302 static $cache = array(); // Cache of unoutputted messages
304303 $text = wfDebugTimer() . $text;
@@ -310,21 +309,11 @@
311310 if ( ( $wgDebugComments || $wgShowDebug ) && !$logonly ) {
312311 $cache[] = $text;
313312
314 - if ( !isset( $wgOut ) ) {
315 - return;
 313+ if ( isset( $wgOut ) && StubObject::isRealObject( $wgOut ) ) {
 314+ // add the message and any cached messages to the output
 315+ array_map( array( $wgOut, 'debug' ), $cache );
 316+ $cache = array();
316317 }
317 - if ( !StubObject::isRealObject( $wgOut ) ) {
318 - if ( $recursion ) {
319 - return;
320 - }
321 - $recursion++;
322 - $wgOut->_unstub();
323 - $recursion--;
324 - }
325 -
326 - // add the message and possible cached ones to the output
327 - array_map( array( $wgOut, 'debug' ), $cache );
328 - $cache = array();
329318 }
330319 if ( $wgDebugLogFile != '' && !$wgProfileOnly ) {
331320 # Strip unprintables; they can switch terminal modes when binary data

Status & tagging log