[wp-trac] [WordPress Trac] #16990: WP Multisite doesn't use custom db-error.php

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 28 19:19:47 UTC 2011


#16990: WP Multisite doesn't use custom db-error.php
-------------------------+-----------------------------
 Reporter:  tmuka        |      Owner:  tmuka
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Multisite    |    Version:  3.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 I suppose this is a feature request. I don't see a way to configure a
 Multisite install to use the same wp-content/db-error.php file as a single
 wp site install uses. Instead where the db is down the page dies on "Error
 establishing database connection" wrapped in an <h1>.

 It could be a complication of using the HyperDB plugin, but it appears
 that on line 104 of wp-includes/ms-settings.php when the db is down
 get_blog_details() obviously fails and wp-includes/ms-
 load.php:ms_not_installed() is called. Unfortunately ms_not_installed()
 does not redirect to db-error.php, and instead dies, returning
 $title = /*WP_I18N_FATAL_ERROR*/'Error establishing database
 connection'/*/WP_I18N_FATAL_ERROR*/;

 Obviously i could hack in a call to wp-includes/functions.php: dead_db()
 in ms-load.php, but i try to avoid any core hacking to make upgrades
 easier.

 Does anyone have a suggestion for overriding this behavior cleanly?
 perhaps something in wp-WP_CONTENT_DIR/sunrise.php ?

 I suppose if somebody else is interested in the simple fix, here it is. In
 "function ms_not_installed" on line 224 of wp-includes/ms-load.php, insert
 dead_db();
 like this...

 {{{
 function ms_not_installed() {
 dead_db(); //hacked this in so we can get use our custom db-error.php
 }}}

 The bottom line is that now the visitor will potentially see a more
 friendly error message when the db or db table is unavailable.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16990>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list