Make WordPress Core

Ticket #33161: 33161.2.diff

File 33161.2.diff, 2.0 KB (added by SergeyBiryukov, 3 years ago)
  • src/wp-includes/load.php

     
    132132 * Retrieves the current environment type.
    133133 *
    134134 * 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.
    136136 *
    137137 * Possible values include 'development', 'staging', 'production'. If not set,
    138138 * the type defaults to 'production'.
     
    167167                $wp_environments = WP_ENVIRONMENT_TYPES;
    168168        }
    169169
    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.0
    176          *
    177          * @param array $wp_environments The list of environment types. Possible values
    178          *                               include 'development', 'staging', 'production'.
    179          */
    180         $wp_environments = apply_filters( 'wp_environment_types', $wp_environments );
    181 
    182170        // Check if the environment variable has been set, if `getenv` is available on the system.
    183171        if ( function_exists( 'getenv' ) ) {
    184172                $has_env = getenv( 'WP_ENVIRONMENT_TYPE' );
     
    192180                $current_env = WP_ENVIRONMENT_TYPE;
    193181        }
    194182
    195         /**
    196          * Filters the current environment type.
    197          *
    198          * This filter runs before it can be used by plugins. It is designed for
    199          * non-web runtimes. The value returned by this filter has a priority over both
    200          * the `WP_ENVIRONMENT_TYPE` system variable and a constant of the same name.
    201          *
    202          * @since 5.5.0
    203          *
    204          * @param string $current_env The current environment type. Possible values
    205          *                            include 'development', 'staging', 'production'.
    206          */
    207         $current_env = apply_filters( 'wp_get_environment_type', $current_env );
    208 
    209183        // Make sure the environment is an allowed one, and not accidentally set to an invalid value.
    210184        if ( ! in_array( $current_env, $wp_environments, true ) ) {
    211185                $current_env = 'production';