diff --git a/wp-includes/functions.php b/wp-includes/functions.php index dca06c3610..a2a5fb4f85 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1529,6 +1529,37 @@ function require_wp_db() { require_once( ABSPATH . WPINC . '/wp-db.php' ); } +function dead_db() { + global $wpdb; + + // Load custom DB error template, if present. + if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) { + require_once( ABSPATH . 'wp-content/db-error.php' ); + die(); + } + + // If installing or in the admin, provide the verbose message. + if ( defined('WP_INSTALLING') || defined('WP_ADMIN') ) + wp_die($wpdb->error); + + // Otherwise, be terse. + status_header( 500 ); + nocache_headers(); + header( 'Content-Type: text/html; charset=utf-8' ); +?> + +> +
+