WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 6 weeks ago

#51162 new enhancement

Consider adding "offline" as environment on WP_ENVIRONMENT_TYPE

Reported by: johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.5
Component: Bootstrap/Load Keywords: 2nd-opinion needs-patch
Focuses: Cc:

Description

Ticket to consider adding a fifth environment type, offline, to the newly added WP_ENVIRONMENT_TYPE functionality.

Originally proposed by @joostdevalk on #50992, the intention being:

this (usually development) environment can not reach the internet and cannot be reached from the internet.

Personally I'm undecided about this. What's the intention with this type? Is it different enough from local? Is there a use case that this covers that local doesn't?

Feedback welcome.

Change History (5)

#1 @roytanck
3 months ago

This overlaps somewhat with existing constants like WP_LOCAL_DEV and WP_HTTP_BLOCK_EXTERNAL. I'm not sure a server's technical configuration (does it have access to the internet?) is really an environment type. Perhaps a new constant would be a better option?

#2 @azaozz
3 months ago

  • Keywords 2nd-opinion removed
  • Type changed from defect (bug) to enhancement

What's the intention with this type?

I've ran into the need for this when running PHP tests and the local install/server cannot reach the internet. Many tests either take quite long to time out or fail. Having such constant/setting would allow these tests to be skipped.

Version 0, edited 3 months ago by azaozz (next)

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


6 weeks ago

#4 follow-up: @johnbillion
6 weeks ago

  • Keywords 2nd-opinion added
  • Milestone changed from 5.5.2 to Future Release

I agree with @roytanck, offline status is distinct from the environment type. I can definitely see a use for an offline flag (Airplane Mode is one of my all time favourite plugins) but I'm not sure that the environment type is the right place for it.

@joostdevalk @azaozz Do you think this needs to be tied to the environment type?

Punting as per bug scrub discussion.

#5 in reply to: ↑ 4 @azaozz
6 weeks ago

  • Keywords needs-patch added

Replying to johnbillion:

I agree with @roytanck, offline status is distinct from the environment type. I can definitely see a use for an offline flag
...
Do you think this needs to be tied to the environment type?

Right, don't think this belongs together with the environment types, it is rather a "characteristic" of the environment. 'Local', 'development', maybe even 'staging' may not have net access depending on the server/firewall/permissions setup.

In that terms another constant makes most sense, perhaps something like WP_OFFLINE?

Last edited 6 weeks ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.