[wp-trac] [WordPress Trac] #57487: Add support for "development mode"
WordPress Trac
noreply at wordpress.org
Sat Jan 21 03:14:23 UTC 2023
#57487: Add support for "development mode"
-------------------------+-----------------------------
Reporter: azaozz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+-----------------------------
Comment (by knutsp):
This has become a mess, but can be kept without a lot of BC breaks this
way:
For `wp_get_environment_type()` add/allow a 'local ' prefix in
`WP_ENVIRONMENT_TYPE`:
{{{#!php
[
'local', // deprecate later, return as 'local development'
'local development',
'local staging',
'local production'.
'development',
'staging',
'production' // default
]
}}}
Maybe also:
Introduce `WP_LOCAL DEV`, which forces the 'local ' prefix (in case not
already set).
In case 'local ' is included and `WP_LOCAL DEV` is undefined, define
`WP_LOCAL DEV` as true.
In case 'local ' is no included and `WP_LOCAL DEV` is undefined, define
`WP_LOCAL DEV` as false.
Finally:
{{{#!php
if ( str_ends_with( wp_get_environment_type(), 'development' ) ) {
//set other development related constants not set earlier
}
}}}
Recommendations for use:
* To check for local or remote, use constant `WP_LOCAL DEV` (preferred) or
`str_starts_with` (possible, giving same result)
* To check for legacy environment type only, also in case on local, use
`str_ends_with` (edge case)
* The common check `if ( 'production' !== wp_get_environment_type() )` on
remote environments will then work as before. 'local production' is new
and a very edge case, maybe useful on intranets.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57487#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list