関数 dead_db()
2014/12/05
定義ファイル :/blog/wp-includes/functions.php 15
dead_db()
データベース接続エラー
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /** * Load 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. * * @since 2.3.2 * * @global wpdb $wpdb WordPress database access abstraction object. */ 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 ( 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' ); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php _e( 'Database Error' ); ?></title> </head> <body> <h1><?php _e( 'Error establishing a database connection' ); ?></h1> </body> </html> <?php die(); } |