From: Tim Starling Date: Sat, 26 Jun 2004 03:28:58 +0000 (+0000) Subject: Nicer looking errors in command line mode X-Git-Tag: 1.5.0alpha1~2771 X-Git-Url: http://git.cyclocoop.org/geomaker.php?a=commitdiff_plain;h=05703f122be250e0002ed5de399b972a81c2f039;p=lhc%2Fweb%2Fwiklou.git Nicer looking errors in command line mode --- diff --git a/includes/Database.php b/includes/Database.php index a103e32e15..f382485813 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -157,7 +157,7 @@ class Database { # If errors are explicitly ignored, returns success function query( $sql, $fname = "" ) { - global $wgProfiling; + global $wgProfiling, $wgCommandLineMode; if ( $wgProfiling ) { # generalizeSQL will probably cut down the query to reasonable @@ -186,7 +186,13 @@ class Database { wfDebug("SQL ERROR (ignored): " . $error . "\n"); } else { wfDebug("SQL ERROR: " . $error . "\n"); - if ( $this->mOut ) { + if ( $wgCommandLineMode ) { + wfDebugDieBacktrace( "A database error has occurred\n" . + "Query: $sql\n" . + "Function: $fname\n" . + "Error: $errno $error\n" + ); + } elseif ( $this->mOut ) { // this calls wfAbruptExit() $this->mOut->databaseError( $fname, $sql, $error, $errno ); } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 08b916276e..dd5197d07d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -370,15 +370,31 @@ function wfAbruptExit(){ } function wfDebugDieBacktrace( $msg = '' ) { + global $wgCommandLineMode; + if ( function_exists( 'debug_backtrace' ) ) { - $msg .= "\n

Backtrace:

\n