wpseek.com
WordPress开发者和主题制作者的搜索引擎



dead_db › WordPress Function

Since2.3.2
已弃用n/a
dead_db ( 没有参数 )
定义在:
文档:

Loads custom DB error or display WordPress DB error.

If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not found, then the WordPress DB error will be displayed instead. The WordPress DB error sets the HTTP status header to 500 to try to prevent search engines from caching the message. Custom DB messages should do the same. This function was backported to WordPress 2.3.2, but originally was added in WordPress 2.5.0.


Related Functions: do_feed_rdf

源码

function dead_db() {
	global $wpdb;

	wp_load_translations_early();

	// Load custom DB error template, if present.
	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
		require_once WP_CONTENT_DIR . '/db-error.php';
		die();
	}

	// If installing or in the admin, provide the verbose message.
	if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
		wp_die( $wpdb->error );
	}

	// Otherwise, be terse.
	wp_die( '<h1>' . __( 'Error establishing a database connection' ) . '</h1>', __( 'Database Error' ) );
}