[wp-trac] [WordPress Trac] #47058: Site Health: does not distinguish between production / staging / development sites

WordPress Trac noreply at wordpress.org
Sat Aug 22 00:40:35 UTC 2020


#47058: Site Health: does not distinguish between production / staging /
development sites
---------------------------+-----------------------
 Reporter:  DavidAnderson  |       Owner:  (none)
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  5.6
Component:  Site Health    |     Version:  5.2
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+-----------------------

Comment (by dkotter):

 I've added a patch that adds a new `is_development_environment` method in
 the `WP_Site_Health` class. This method uses the new
 `wp_get_environment_type` function, to check if we're in a development
 environment. It also checks if the URL us using localhost (which is a
 check used a couple times already in this class).

 If either of those checks match, we return true in that method. I've then
 implemented this method in the debug mode test, so if a development
 environment is being used, we change the status from `critical` to
 `recommended`. We do this in both the `WP_DEBUG_LOG` check and the
 `WP_DEBUG_DISPLAY` check.

 Note, if we don't want to add a new method, this code could be added
 inline in both places. I figured to avoid duplicate code, I'd extract that
 to make it more reusable.

 This made the most sense to me, changing that to a recommended notice on
 development environments instead of critical, but this could be taken
 further, if we think updating the message would also be helpful.

 In addition to changing the status here, we could also change the message,
 if there's more appropriate language for this check on development
 environments.

 Also, with this new method, it's easy to add this check within other tests
 here, if needed. I know it was mentioned maybe updates would be one we
 might want to alter for development environments, though not exactly sure
 what we would want to change there.

 Open to any suggestions or thoughts on how I implemented this though.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47058#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list