function wfQuery( $sql, $db, $fname = "" )
{
global $wgLastDatabaseQuery, $wgOut, $wgDebugDumpSql;
+ global $wgProfiling;
- # wfGeneralizeSQL will probably cut down the query to reasonable
- # logging size most of the time. The substr is really just a sanity check.
- $profName = "wfQuery: " . substr( wfGeneralizeSQL( $sql ), 0, 255 );
-
- wfProfileIn( $profName );
+ if ( $wgProfiling ) {
+ # wfGeneralizeSQL will probably cut down the query to reasonable
+ # logging size most of the time. The substr is really just a sanity check.
+ $profName = "wfQuery: " . substr( wfGeneralizeSQL( $sql ), 0, 255 );
+
+ wfProfileIn( $profName );
+ }
if ( !is_numeric( $db ) ) {
# Someone has tried to call this the old way
$wgOut->databaseError( $fname );
exit;
}
- wfProfileOut( $profName );
+
+ if ( $wgProfiling ) {
+ wfProfileOut( $profName );
+ }
return $ret;
}