static $recursion = 0;
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 ) {
}
}
+function wfDebugTimer() {
+ global $wgDebugTimestamps;
+ if ( !$wgDebugTimestamps ) return '';
+ static $start = null;
+
+ if ( $start === null ) {
+ $start = microtime( true );
+ $prefix = "\n$start";
+ } else {
+ $prefix = sprintf( "%6.4f", microtime( true ) - $start );
+ }
+
+ return $prefix . ' ';
+}
+
/**
* Send a line giving PHP memory usage.
* @param $exact Bool: print exact values instead of kilobytes (default: false)
# Useful debug output
if ( $wgCommandLineMode ) {
wfDebug( "\n\nStart command line script $self\n" );
-} elseif ( function_exists( 'getallheaders' ) ) {
- wfDebug( "\n\nStart request\n" );
- wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
- $headers = getallheaders();
- foreach ($headers as $name => $value) {
- wfDebug( "$name: $value\n" );
- }
- wfDebug( "\n" );
-} elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
- wfDebug( "\n\nStart request\n" );
+} else {
+ wfDebug( "Start request\n\n" );
wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
- foreach ( $_SERVER as $name => $value ) {
- if ( substr( $name, 0, 5 ) == 'HTTP_' ) {
+ $header_out = "HTTP HEADERS:\n";
+
+ if ( function_exists( 'getallheaders' ) ) {
+ $headers = getallheaders();
+ foreach ( $headers as $name => $value ) {
+ $header_out .= "$name: $value\n";
+ }
+ } else {
+ $headers = $_SERVER;
+ foreach ( $headers as $name => $value ) {
+ if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue;
$name = substr( $name, 5 );
- wfDebug( "$name: $value\n" );
+ $header_out .= "$name: $value\n";
}
}
- wfDebug( "\n" );
+
+ if ( $wgDebugPrintHttpHeaders ) {
+ wfDebug( "$header_out\n" );
+ }
}
if( $wgRCFilterByAge ) {
$messageMemc =& wfGetMessageCacheStorage();
$parserMemc =& wfGetParserCacheStorage();
-wfDebug( 'Main cache: ' . get_class( $wgMemc ) .
- "\nMessage cache: " . get_class( $messageMemc ) .
- "\nParser cache: " . get_class( $parserMemc ) . "\n" );
+wfDebug( 'CACHES: ' . get_class( $wgMemc ) . '[main] ' .
+ get_class( $messageMemc ) . '[message] ' .
+ get_class( $parserMemc ) . "[parser]\n" );
wfProfileOut( $fname.'-memcached' );