Fixed $wgDebugComments
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 4 Aug 2006 20:15:07 +0000 (20:15 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 4 Aug 2006 20:15:07 +0000 (20:15 +0000)
includes/GlobalFunctions.php
skins/MonoBook.php

index 090d965..dc299f6 100644 (file)
@@ -190,13 +190,25 @@ function wfUrlencode ( $s ) {
  */
 function wfDebug( $text, $logonly = false ) {
        global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
+       static $recursion = 0;
 
        # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
        if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
                return;
        }
 
-       if ( isset( $wgOut ) && $wgDebugComments && !$logonly ) {
+       if ( $wgDebugComments && !$logonly ) {
+               if ( !isset( $wgOut ) ) {
+                       return;
+               }
+               if ( !StubObject::isRealObject( $wgOut ) ) {
+                       if ( $recursion ) {
+                               return;
+                       }
+                       $recursion++;
+                       $wgOut->_unstub();
+                       $recursion--;
+               }
                $wgOut->debug( $text );
        }
        if ( '' != $wgDebugLogFile && !$wgProfileOnly ) {
index 81e9236..6063b39 100644 (file)
@@ -269,7 +269,12 @@ class MonoBookTemplate extends QuickTemplate {
        <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
 </div>
 <?php $this->html('reporttime') ?>
+<?php if ( $this->data['debug'] ): ?>
+<!-- Debug output:
+<?php $this->text( 'debug' ); ?>
 
+-->
+<?php endif; ?>
 </body></html>
 <?php
        wfRestoreWarnings();