bedrock
bedrock copied to clipboard
Use the new constant WP_ENVIRONMENT_TYPE
- [x] I've read the guidelines for Contributing to Roots Projects
- [x] This request isn't a duplicate of an existing request
- [x] This is not a personal support request that should be posted on the Roots Discourse community
Summary
WordPress 5.5 introduce environment.I think it could be a good idea to use the new variable WP_ENVIRONMENT_TYPE
instead of WP_ENV
Motivation
User are still going to add the new WP_ENVIRONMENT_TYPE
so we are going to have two constant that have the same purpose.
I'm having some doubts here. I mean - having those separate is a bit strange, don't you think?
Or maybe we should set it like this: if no WP_ENVIRONMENT_TYPE is set we should set WP_ENVIRONMENT_TYPE to be the same as WP_ENV.
Or should they always be separated?
Yes we'd likely support both transparently. So we'd set WP_ENVIRONMENT_TYPE
according to WP_ENV
and vice versa.
However, I think there's still hope that the wp_get_environment_type
function will check WP_ENV
as well.
Looking at this https://core.trac.wordpress.org/ticket/33161 - I don't think there is hope for WP_ENV :/
But aside - so in short:
- if both are defined - we just define theme as they are
- if only one is defined we define as the second one
I can do a PR for this.
Before I would push a PR - could you take a look:
Config::define('WP_ENVIRONMENT_TYPES', env('WP_ENVIRONMENT_TYPES') ? explode(',', env('WP_ENVIRONMENT_TYPES')) : ['production', 'staging', 'development']);
if (env('WP_ENV') || env('WP_ENVIRONMENT_TYPE')) {
Config::define('WP_ENV', env('WP_ENV') ?: env('WP_ENVIRONMENT_TYPE'));
Config::define('WP_ENVIRONMENT_TYPE', env('WP_ENVIRONMENT_TYPE') ?: env('WP_ENV'));
define('WP_ENV', env('WP_ENV') ?: env('WP_ENVIRONMENT_TYPE'));
} else {
Config::define('WP_ENV', 'production');
define('WP_ENV', 'production');
}
I also prepared the WP_ENVIRONMENT_TYPES - I think it covers all the cases.
@palmiak thank you! want to push a PR and i can tag some people to review over there?
Just wanted to make sure it solid - I'll prepare the PR soon
śr., 12 sie 2020, 06:22 użytkownik Ben Word [email protected] napisał:
@palmiak https://github.com/palmiak thank you! want to push a PR and i can tag some people to review over there?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roots/bedrock/issues/538#issuecomment-672563940, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR34OTUN66UZ7JQ62ZOBU3SAIKIFANCNFSM4PKF6NCA .
Of note, 5.5.1 added local
as an option (thankfully). link
https://github.com/roots/bedrock/pull/668