Ticket #33161: 33161.2.diff
File 33161.2.diff, 2.0 KB (added by , 3 years ago) |
---|
-
src/wp-includes/load.php
132 132 * Retrieves the current environment type. 133 133 * 134 134 * The type can be set via the `WP_ENVIRONMENT_TYPE` global system variable, 135 * a constant of the same name, or the {@see 'wp_get_environment_type'} filter.135 * or a constant of the same name. 136 136 * 137 137 * Possible values include 'development', 'staging', 'production'. If not set, 138 138 * the type defaults to 'production'. … … 167 167 $wp_environments = WP_ENVIRONMENT_TYPES; 168 168 } 169 169 170 /**171 * Filters the list of supported environment types.172 *173 * This filter runs before it can be used by plugins. It is designed for non-web runtimes.174 *175 * @since 5.5.0176 *177 * @param array $wp_environments The list of environment types. Possible values178 * include 'development', 'staging', 'production'.179 */180 $wp_environments = apply_filters( 'wp_environment_types', $wp_environments );181 182 170 // Check if the environment variable has been set, if `getenv` is available on the system. 183 171 if ( function_exists( 'getenv' ) ) { 184 172 $has_env = getenv( 'WP_ENVIRONMENT_TYPE' ); … … 192 180 $current_env = WP_ENVIRONMENT_TYPE; 193 181 } 194 182 195 /**196 * Filters the current environment type.197 *198 * This filter runs before it can be used by plugins. It is designed for199 * non-web runtimes. The value returned by this filter has a priority over both200 * the `WP_ENVIRONMENT_TYPE` system variable and a constant of the same name.201 *202 * @since 5.5.0203 *204 * @param string $current_env The current environment type. Possible values205 * include 'development', 'staging', 'production'.206 */207 $current_env = apply_filters( 'wp_get_environment_type', $current_env );208 209 183 // Make sure the environment is an allowed one, and not accidentally set to an invalid value. 210 184 if ( ! in_array( $current_env, $wp_environments, true ) ) { 211 185 $current_env = 'production';