In `wpdb::db_connect()`, allow the loading of a custom database error template - this is already allowed in `dead_db()`.
In `dead_db()`, move the call to `wp_load_translations_early()` before the inclusion of the `db-error.php` file to allow translation in both locations before the template is loaded. Props sbruner, kovshenin. Fixes #25703. Built from https://develop.svn.wordpress.org/trunk@27056 git-svn-id: http://core.svn.wordpress.org/trunk@26929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ad211ca06a
commit
678ef2b1e1
|
@ -2793,6 +2793,8 @@ function wp_ob_end_flush_all() {
|
|||
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' );
|
||||
|
@ -2807,8 +2809,6 @@ function dead_db() {
|
|||
status_header( 500 );
|
||||
nocache_headers();
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
|
||||
wp_load_translations_early();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
|
||||
|
|
|
@ -1154,6 +1154,13 @@ class wpdb {
|
|||
|
||||
if ( !$this->dbh ) {
|
||||
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();
|
||||
}
|
||||
|
||||
$this->bail( sprintf( __( "
|
||||
<h1>Error establishing a database connection</h1>
|
||||
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
|
||||
|
|
Loading…
Reference in New Issue