Add query count to $wgDebugDumpSql output
authorAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 16 Aug 2010 22:29:27 +0000 (22:29 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 16 Aug 2010 22:29:27 +0000 (22:29 +0000)
This makes it easy to see how many queries are being run on each view.
Also rephrased the message a bit.

includes/db/Database.php

index 4770293..250844b 100644 (file)
@@ -493,12 +493,14 @@ abstract class DatabaseBase {
                }
 
                if ( $this->debug() ) {
+                       static $cnt = 0;
+                       $cnt++;
                        $sqlx = substr( $commentedSql, 0, 500 );
                        $sqlx = strtr( $sqlx, "\t\n", '  ' );
                        if ( $isMaster ) {
-                               wfDebug( "SQL-master: $sqlx\n" );
+                               wfDebug( "Query $cnt (master): $sqlx\n" );
                        } else {
-                               wfDebug( "SQL: $sqlx\n" );
+                               wfDebug( "Query $cnt (slave): $sqlx\n" );
                        }
                }