WordPress.org

Make WordPress Core

Changeset 31657


Ignore:
Timestamp:
03/07/2015 05:34:47 AM (5 years ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-load.php

    r30982 r31657  
    396396    global $wpdb, $domain, $path;
    397397
     398    if ( ! is_admin() ) {
     399        dead_db();
     400    }
     401
    398402    wp_load_translations_early();
    399403
    400404    $title = __( 'Error establishing a database connection' );
     405
    401406    $msg  = '<h1>' . $title . '</h1>';
    402     if ( ! is_admin() ) {
    403         die( $msg );
    404     }
    405407    $msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
    406408    $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
     
    421423    $msg .= '</ul>';
    422424
    423     wp_die( $msg, $title );
     425    wp_die( $msg, $title, array( 'response' => 500 ) );
    424426}
    425427
Note: See TracChangeset for help on using the changeset viewer.