Opened 10 years ago
Closed 10 years ago
#30002 closed enhancement (fixed)
ms_not_installed returns 200
Reported by: | spacedmonkey | Owned by: | craig-ralston |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | Networks and Sites | Keywords: | good-first-bug has-patch |
Focuses: | multisite | Cc: |
Description
The ms_not_installed function returns apache state 200. It should return 500. Also there should been an action / filter to modify behaviour within this code.
Attachments (3)
Change History (17)
#2
@
10 years ago
We should probably follow whatever dead_db() does. It's possible that dead_db() can be updated to take an arbitrary WP_Error|string
as a first argument, defaulting to $wpdb->error otherwise (which is also WP_Error|string
). If dead_db() is calling wp_die() early then we should be able to also.
#3
@
10 years ago
I thought it would be better to just call dead_db function from ms_not_installed. It means less code and translation to maintain.
#6
@
10 years ago
Seems it's possible to replace the die
with wp_die
inside that function, no? Just wp_die( $msg, $title );
. dead_db
is a bit messy and should probably be itself calling wp_die
.
#8
@
10 years ago
- Keywords has-patch added
If I'm not mistaken, this is as simple as updating to use wp_die()
in ms_not_installed()
.
Note: dead_db()
also calls wp_die()
.
Adding an action to ms_not_installed()
is also a good idea but probably should be in a separate ticket, I imagine.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
10 years ago
This ticket was mentioned in Slack in #core-multisite by craigralston. View the logs.
10 years ago
#13
@
10 years ago
I think we should go with calling dead_db()
instead. It provides the ability to show a custom db-error.php
page and handles the 500 error exactly the same as ms_not_installed()
would otherwise.
We can also take a cue from is_blog_installed()
and set a custom $wpdb->error
so that a db-error.php
template can act accordingly. Everything we currently store in $msg
could be passed this way and ms_not_installed()
can just use dead_db()
. A more generic message that doesn't rely on a DB query can be used when not in is_admin()
.
In [14317], we moved from
die()
, which returns 200, towp_die()
, which returns 500 by default - but only in admin views. I'm not sure if there's a good reason to stick withdie()
.If we did switch to
wp_die()
, then a filter is available forwp_die_handler
to customize that message.We could also consider an action in
ms_not_installed()
.