WordPress.org

Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#41655 new enhancement

Enable dead_db() to be trappable always.

Reported by: gitlost Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Database Keywords: has-patch
Focuses: Cc:

Description

It would be handy if dead_db() could be made trappable always, either through using wp_die() instead of die() in the terse case, or via a filter.

It currently causes WP-CLI (see https://github.com/wp-cli/wp-cli/pull/4303) to resort to a brittle hack in order to trap database connection errors.

Attachments (5)

terse_die-360.jpg (34.6 KB) - added by gitlost 5 weeks ago.
Terse die() at 360 width Firefox.
terse_wp_die-360.jpg (19.8 KB) - added by gitlost 5 weeks ago.
Terse wp_die() at 360 width Firefox.
terse_die-1280.jpg (37.5 KB) - added by gitlost 5 weeks ago.
Terse die() at 1280 width Firefox.
terse_wp_die-1280.jpg (22.6 KB) - added by gitlost 5 weeks ago.
Terse wp_die() at 1280 width Firefox.
41655.patch (856 bytes) - added by gitlost 5 weeks ago.
Patch to use wp_die() instead of die() in the terse case in dead_db().

Download all attachments as: .zip

Change History (7)

@gitlost
5 weeks ago

Terse die() at 360 width Firefox.

@gitlost
5 weeks ago

Terse wp_die() at 360 width Firefox.

@gitlost
5 weeks ago

Terse die() at 1280 width Firefox.

@gitlost
5 weeks ago

Terse wp_die() at 1280 width Firefox.

#1 @gitlost
5 weeks ago

The above are before/afters if die() were replaced by wp_die() in the terse case, eg

wp_die( '<h1>' . __( 'Error establishing a database connection' ) . '</h1>', __( 'Database Error' ) );
Last edited 5 weeks ago by gitlost (previous) (diff)

@gitlost
5 weeks ago

Patch to use wp_die() instead of die() in the terse case in dead_db().

#2 @Soean
5 weeks ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.