Make WordPress Core

Opened 23 months ago

Closed 19 months ago

Last modified 19 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 23 months ago.
screenshot.jpg (60.2 KB) - added by sbruner 23 months ago.
Screenshot of current error screen
25703.diff (1.5 KB) - added by kovshenin 20 months ago.

Download all attachments as: .zip

Change History (8)

@sbruner23 months ago

@sbruner23 months ago

Screenshot of current error screen

comment:1 @SergeyBiryukov22 months ago

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

comment:2 @nacin20 months ago

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

Makes sense to me! Will check it out.

@kovshenin20 months ago

comment:3 @kovshenin20 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

comment:4 @wonderboymusic19 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.

comment:5 @nacin19 months ago

[27056] looks great.

Note: See TracTickets for help on using tickets.