Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -176,12 +176,16 @@ |
177 | 177 | global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage; |
178 | 178 | static $recursion = 0; |
179 | 179 | |
| 180 | + static $cache = array(); // Cache of unoutputted messages |
| 181 | + |
180 | 182 | # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet |
181 | 183 | if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) { |
182 | 184 | return; |
183 | 185 | } |
184 | 186 | |
185 | 187 | if ( $wgDebugComments && !$logonly ) { |
| 188 | + $cache[] = $text; |
| 189 | + |
186 | 190 | if ( !isset( $wgOut ) ) { |
187 | 191 | return; |
188 | 192 | } |
— | — | @@ -193,7 +197,10 @@ |
194 | 198 | $wgOut->_unstub(); |
195 | 199 | $recursion--; |
196 | 200 | } |
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(); |
198 | 205 | } |
199 | 206 | if ( '' != $wgDebugLogFile && !$wgProfileOnly ) { |
200 | 207 | # Strip unprintables; they can switch terminal modes when binary data |