summaryrefslogtreecommitdiffstats
path: root/wp-includes/wp-db.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-04-07 06:45:41 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-04-07 06:45:41 +0000
commitac903889e7e7c6bf169af72cca7b8f774bee02a8 (patch)
treea12f9e912b199bfd3e296d37338394848ed2a915 /wp-includes/wp-db.php
parent0964bc70d7bf124be8bb8d1e8579fedd6f310802 (diff)
downloadwordpress-mu-ac903889e7e7c6bf169af72cca7b8f774bee02a8.tar.gz
wordpress-mu-ac903889e7e7c6bf169af72cca7b8f774bee02a8.tar.xz
wordpress-mu-ac903889e7e7c6bf169af72cca7b8f774bee02a8.zip
Send errors to error_log to avoid "bugs" like this: http://trac.mu.wordpress.org/ticket/304
If ERRORLOGFILE defined use that file instead. If DIEONDBERROR defined then halt script with error message (Do not use on a production server!) Define constants in wp-config.php like this: define('ERRORLOGFILE', '/tmp/mysq.log'); define('DIEONDBERROR', 1); git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@957 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wp-db.php')
-rw-r--r--wp-includes/wp-db.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index 89b2a37..d829cd5 100644
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -129,10 +129,13 @@ class wpdb {
// Is error output turned on or not..
if ( $this->show_errors ) {
// If there is an error then take note of it
- print "<div id='error'>
- <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
- <code>$query</code></p>
- </div>";
+ $msg = "WordPress database error: [$str]\n$query\n";
+ if( defined( 'ERRORLOGFILE' ) )
+ error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
+ else
+ error_log( $msg, 0 );
+ if( defined( 'DIEONDBERROR' ) )
+ die( $msg );
} else {
return false;
}