From fbebb744b0bee027cfda2690ad39b2a77c9a13b0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 28 Jul 2020 12:10:05 +0000 Subject: [PATCH] Bootstrap/Load: Remove the `wp_environment_type` and `wp_get_environment_type` filters. Since `wp_get_environment_type()` runs too early for plugins to hook these filters, and the result is then cached in a static variable and cannot be changed later, the filters are not that useful. The `WP_ENVIRONMENT_TYPES` and `WP_ENVIRONMENT_TYPE` constants and environment variables should be enough for now. Follow-up to [47919], [48188], [48372]. Props Clorith, SergeyBiryukov. Fixes #33161. Built from https://develop.svn.wordpress.org/trunk@48662 git-svn-id: http://core.svn.wordpress.org/trunk@48424 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 28 +--------------------------- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index c82cd1d405..82e92082be 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -132,7 +132,7 @@ function wp_check_php_mysql_versions() { * Retrieves the current environment type. * * The type can be set via the `WP_ENVIRONMENT_TYPE` global system variable, - * a constant of the same name, or the {@see 'wp_get_environment_type'} filter. + * or a constant of the same name. * * Possible values include 'development', 'staging', 'production'. If not set, * the type defaults to 'production'. @@ -167,18 +167,6 @@ function wp_get_environment_type() { $wp_environments = WP_ENVIRONMENT_TYPES; } - /** - * Filters the list of supported environment types. - * - * This filter runs before it can be used by plugins. It is designed for non-web runtimes. - * - * @since 5.5.0 - * - * @param array $wp_environments The list of environment types. Possible values - * include 'development', 'staging', 'production'. - */ - $wp_environments = apply_filters( 'wp_environment_types', $wp_environments ); - // Check if the environment variable has been set, if `getenv` is available on the system. if ( function_exists( 'getenv' ) ) { $has_env = getenv( 'WP_ENVIRONMENT_TYPE' ); @@ -192,20 +180,6 @@ function wp_get_environment_type() { $current_env = WP_ENVIRONMENT_TYPE; } - /** - * Filters the current environment type. - * - * This filter runs before it can be used by plugins. It is designed for - * non-web runtimes. The value returned by this filter has a priority over both - * the `WP_ENVIRONMENT_TYPE` system variable and a constant of the same name. - * - * @since 5.5.0 - * - * @param string $current_env The current environment type. Possible values - * include 'development', 'staging', 'production'. - */ - $current_env = apply_filters( 'wp_get_environment_type', $current_env ); - // Make sure the environment is an allowed one, and not accidentally set to an invalid value. if ( ! in_array( $current_env, $wp_environments, true ) ) { $current_env = 'production'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 6283527a86..5a999cd05c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta4-48661'; +$wp_version = '5.5-beta4-48662'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.