Make WordPress Core

Opened 17 months ago

Last modified 5 weeks ago

#58484 reviewing enhancement

Site Health: Improve display of constants in debug data

Reported by: ramon-fincken's profile ramon fincken Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version: 6.3
Component: Site Health Keywords: has-patch changes-requested
Focuses: Cc:

Description (last modified by SergeyBiryukov)

This is a follow up on #55741.

where we need to have just a single function to be called which determines the environment type.

As wp-admin/includes/class-wp-debug-data.php is already using:

$environment_type       = wp_get_environment_type();

and later on:
this happens

		// Check WP_ENVIRONMENT_TYPE.
		if ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE ) {
			$wp_environment_type = WP_ENVIRONMENT_TYPE;
		} else {
			$wp_environment_type = __( 'Undefined' );
		}

so this is not the same as what happens at wp_get_environment_type();

So this ticket is where we remove that lines of code.

Attachments (7)

patch.58484.20230608.1.diff (702 bytes) - added by ramon fincken 17 months ago.
patch.58484.20230608.1.diff
patch.58484.20230608.2.diff (680 bytes) - added by ramon fincken 17 months ago.
patch.58484.20230608.2.diff
patch.58484.20230608.3.diff (3.0 KB) - added by ramon fincken 17 months ago.
patch.58484.20230608.3.diff
patch.58484.20231019.4.diff (2.9 KB) - added by ramon fincken 13 months ago.
patch.58484.20231019.4.diff
patch.58484.20231019.5.diff (3.1 KB) - added by ramon fincken 13 months ago.
patch.58484.20231019.5.diff
patch.58484.20231019.6.diff (4.0 KB) - added by ramon fincken 13 months ago.
patch.58484.20231019.6.diff
patch.58484.20231019.7.diff (3.9 KB) - added by ramon fincken 13 months ago.
patch.58484.20231019.7.diff

Download all attachments as: .zip

Change History (27)

@ramon fincken
17 months ago

patch.58484.20230608.1.diff

This ticket was mentioned in Slack in #core by ramonfincken. View the logs.


17 months ago

#2 @ramon fincken
17 months ago

a small update on this, checked with @SergeyBiryukov

this code is accurate meaning it is shown in the tools -> constants.

I will just show the PHP constant which does not have a need to call wp_get_environment_type()

However ... if you have defined WP_ENVIRONMENT_TYPE and it is empty this code will show "Undefined" while it is actually defined indeed.

#3 @ramon fincken
17 months ago

creating a new patch for this

@ramon fincken
17 months ago

patch.58484.20230608.2.diff

@ramon fincken
17 months ago

patch.58484.20230608.3.diff

#4 @ramon fincken
17 months ago

Added function

private static function get_define_info( $constant_name ) {

#5 @ramon fincken
13 months ago

Updated patch for latest Core version.

@ramon fincken
13 months ago

patch.58484.20231019.4.diff

@ramon fincken
13 months ago

patch.58484.20231019.5.diff

@ramon fincken
13 months ago

patch.58484.20231019.6.diff

@ramon fincken
13 months ago

patch.58484.20231019.7.diff

This ticket was mentioned in PR #5529 on WordPress/wordpress-develop by @ramon fincken.


13 months ago
#6

Trac ticket: https://core.trac.wordpress.org/ticket/58484

PR to enhance the tools section to show the actual result of defines.

#7 @SergeyBiryukov
13 months ago

  • Component changed from Bootstrap/Load to Site Health
  • Description modified (diff)
  • Milestone changed from Awaiting Review to 6.5
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
  • Summary changed from Always use wp_get_environment_type in all sources to Site Health: Improve display of constants in debug data

#8 @ramon fincken
13 months ago

The github PR is the latest. Checked with @ocean90 .

So .. we have the changed code to reflect the actual values.
Also we needed a change for the debug values as you can define an empty string or for instance a NULL/null. Therefore we needed to rewrite the isset to key_exists.

Also some translator instructions were added.

We choose to use multi if instead of match/switch because it is more human readable.

#9 @swissspidy
9 months ago

@SergeyBiryukov Is this on your radar still for 6.5? Looks like a punt candidate given the lack of activity.

#10 @swissspidy
8 months ago

  • Milestone changed from 6.5 to 6.6
  • Type changed from defect (bug) to enhancement

Looks more like an enhancement to me, so punting.

#11 @ramon fincken
7 months ago

Bummer it did not make it in 6.5

#12 @oglekler
6 months ago

I think this new function should also handle case for WP_DEBUG_LOG and possibly two conditions (for true and false) can be replaced with one is_bool();

Btw, we have 2 weeks until Beta 1 and this is clearly an enhancement.

This ticket was mentioned in Slack in #core by nhrrob. View the logs.


5 months ago

#14 @nhrrob
5 months ago

We have reviewed this ticket in today's bug scrub.
@SergeyBiryukov do you think it can land in 6.6?

What else is needed to move it forward?

Thank you.

#15 @oglekler
5 months ago

  • Keywords changes-requested added
  • Milestone changed from 6.6 to 6.7

We have 2 days before Beta 1 and no concrete decision, so, I am moving this ticket to the next milestone for further work.

#16 @ramon fincken
4 months ago

Can we try to get it into 6.6.1 ?

This ticket was mentioned in Slack in #core by stoyangeorgiev. View the logs.


6 weeks ago

This ticket was mentioned in Slack in #core by stoyangeorgiev. View the logs.


5 weeks ago

#20 @stoyangeorgiev
5 weeks ago

  • Milestone changed from 6.7 to Future Release

This one was discussed at a few bug-scrubs and setting the milestone to a Future-Release is something we can do with 6.7 right around the corner. It can be moved to 6.8 when the time is right!

Cheers!

Note: See TracTickets for help on using tickets.