WordPress.org

Make WordPress Core

Opened 10 years ago

Last modified 5 months ago

#10883 assigned enhancement

db-error.php not used for all DB failures

Reported by: markjaquith Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8.4
Component: Database Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

db-error.php (the optional custom DB error message file to be placed in wp-content) does not get included all the time. Sometimes wp-db.php will use its bail() method to spit out its own message. This code needs to be there too:

        if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
                require_once( WP_CONTENT_DIR . '/db-error.php' );
                die();
        }

Change History (10)

#1 @scribu
10 years ago

  • Keywords needs-patch added
  • Milestone changed from Unassigned to 3.0

#2 @scribu
10 years ago

  • Component changed from Cron to Database
  • Owner changed from westi to ryan

#3 @dd32
10 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 3.0 to 3.1
  • Type changed from defect (bug) to enhancement

The purpose of the db-error.php was for prettying up the front-end database connection error screen, or giving some other form of feedback. It has never affected the back-end.

I'm not sure using it for the backend failure cases is a good idea, it'll mean that anyone currently using the file will have to modify it in order to see the DB errors.

Shifting to 3.1 pending patch & feedback from others..

#4 @nacin
9 years ago

  • Milestone changed from Awaiting Triage to Future Release

#5 @carstenbach
8 years ago

  • Cc carstenbach added

#6 @TJNowell
7 years ago

Has anything changed regarding this subject? db-error.php on the backend or even a second backend version would be useful, clients aren't always looking at the frontend and you're more likely to suffer the consequences of bad reputation and lost revenue when the person paying you money gets an obscure generic DB error while saving a post, than a random user who gets one on the frontend and just closes the tab.

A lot of db-error.php implementations send notification emails, so if such an error occurs on the backend, said email won't be sent despite the expectation from most that it will.

#7 @jose@…
7 years ago

  • Cc jose@… added

I am also wondering if this is going to be implemented any time soon. It is not true that the standard message appears only on the back-end. In my experience db-error.php is not called if there is a connection error on the front-end. For the time being, I just added the conditional below just before the bail function as suggested above.

        if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
                require_once( WP_CONTENT_DIR . '/db-error.php' );
                die();
        }

If you don't want to do it permanently, at least give us a filter so we can change it through a custom function.

Thanks.

#8 @ryan
5 years ago

  • Owner ryan deleted
  • Status changed from new to assigned

#9 @chriscct7
4 years ago

  • Keywords 2nd-opinion removed

This ticket was mentioned in Slack in #core by sergey. View the logs.


5 months ago

Note: See TracTickets for help on using tickets.