WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 3 months ago

Last modified 3 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:

Description

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

Download all attachments as: .zip

Change History (8)

sbruner6 months ago

sbruner6 months ago

Screenshot of current error screen

comment:1 SergeyBiryukov5 months ago

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

comment:2 nacin3 months ago

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

Makes sense to me! Will check it out.

kovshenin3 months ago

comment:3 kovshenin3 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 wonderboymusic3 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 nacin3 months ago

[27056] looks great.

Note: See TracTickets for help on using tickets.