Make WordPress Core

Opened 2 years ago

Closed 22 months ago

Last modified 22 months ago

#25703 closed enhancement (fixed)

Allow custom template for database connection failure

Reported by: sbruner Owned by: wonderboymusic
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.7
Component: Database Keywords: has-patch commit
Focuses: Cc:


In the dead_db() function in wp-includes/functions.php, we allow for a custom template to load if the there is a db error. This same template could be used in db_connect().

Attachments (3)

wp-db.php.patch (541 bytes) - added by sbruner 2 years ago.
screenshot.jpg (60.2 KB) - added by sbruner 2 years ago.
Screenshot of current error screen
25703.diff (1.5 KB) - added by kovshenin 23 months ago.

Download all attachments as: .zip

Change History (8)

2 years ago

2 years ago

Screenshot of current error screen

#1 @SergeyBiryukov
2 years ago

  • Component changed from General to Database
  • Version changed from trunk to 3.7

#2 @nacin
23 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.9

Makes sense to me! Will check it out.

23 months ago

#3 @kovshenin
23 months ago

Should developers expect translations to be loaded before the db-error.php drop-in is included?

Because right now it depends on whether dead_db() is called in is_blog_installed() or in wp_set_wpdb_vars(), and db_connect() seems to suffer from the same issue with the proposed patch. Since we load translations anyway before displaying the default errors, I guess there's no problem in loading them for db-error.php.

See 25703.diff

#4 @wonderboymusic
22 months ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 27056:

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.

#5 @nacin
22 months ago

[27056] looks great.

Note: See TracTickets for help on using tickets.