Return HTTP status code 500 by default in ms_not_installed()

In admin views, specify a response code of 500 when using `wp_die()` to show an expanded message for a broken or missing multisite installation.

On front end views, use `dead_db()` rather than `die()` to generate the generic "Error establishing a database connection" message. `dead_db()` sets a status code of 500 by default and allows for the override of this generic error with a `db-error.php` template.

Props craig-ralston, jeremyfelt.

Fixes #30002.

Built from https://develop.svn.wordpress.org/trunk@31657


git-svn-id: http://core.svn.wordpress.org/trunk@31638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-03-07 05:35:26 +00:00
parent 63ceacb67a
commit 3c4b95c1e3
2 changed files with 7 additions and 5 deletions

View File

@ -395,13 +395,15 @@ function get_site_by_path( $domain, $path, $segments = null ) {
function ms_not_installed() {
global $wpdb, $domain, $path;
if ( ! is_admin() ) {
dead_db();
}
wp_load_translations_early();
$title = __( 'Error establishing a database connection' );
$msg = '<h1>' . $title . '</h1>';
if ( ! is_admin() ) {
die( $msg );
}
$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
$msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
@ -420,7 +422,7 @@ function ms_not_installed() {
}
$msg .= '</ul>';
wp_die( $msg, $title );
wp_die( $msg, $title, array( 'response' => 500 ) );
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31656';
$wp_version = '4.2-alpha-31657';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.