From da19724be90b03bc5e00e03eb7790c5483620892 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 27 Aug 2020 21:32:08 +0000 Subject: [PATCH] Bootstrap/Load: Remove the ability to alter the list of environment types in `wp_get_environment_type()`. The intention of `wp_get_environment_type()` is to provide a consistent means of identifying the environment type, not of identifying a specific environment. Actual environments should fit within one of the existing types: `local`, `development`, `staging`, or `production`. That should cover the types that plugins and themes might be concerned about when toggling functionality. Props johnbillion, joostdevalk, TimothyBlynJacobs, jeremyfelt, batmoo, claytoncollie, Clorith, markjaquith, garrett-eclipse, GaryJ, elrae. Fixes #50992. Built from https://develop.svn.wordpress.org/trunk@48894 git-svn-id: http://core.svn.wordpress.org/trunk@48656 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 22 ++++++++++------------ wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index 3fc74006a0..e38fdc66c9 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -138,7 +138,8 @@ function wp_check_php_mysql_versions() { * If not set, the type defaults to 'production'. * * @since 5.5.0 - * @since 5.5.1 The 'local' type was added. + * @since 5.5.1 Added the 'local' type. + * @since 5.5.1 Removed the ability to alter the list of types. * * @return string The current environment type. */ @@ -156,17 +157,14 @@ function wp_get_environment_type() { 'production', ); - // Check if the environment variable has been set, if `getenv` is available on the system. - if ( function_exists( 'getenv' ) ) { - $has_env = getenv( 'WP_ENVIRONMENT_TYPES' ); - if ( false !== $has_env ) { - $wp_environments = explode( ',', $has_env ); - } - } - - // Fetch the environment types from a constant, this overrides the global system variable. - if ( defined( 'WP_ENVIRONMENT_TYPES' ) ) { - $wp_environments = WP_ENVIRONMENT_TYPES; + // Add a note about the deprecated WP_ENVIRONMENT_TYPES constant. + if ( defined( 'WP_ENVIRONMENT_TYPES' ) && function_exists( '_deprecated_argument' ) ) { + _deprecated_argument( + 'define()', + '5.5.1', + /* translators: %s: WP_ENVIRONMENT_TYPES */ + sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' ) + ); } // Check if the environment variable has been set, if `getenv` is available on the system. diff --git a/wp-includes/version.php b/wp-includes/version.php index 9ef918b708..20e44dcf6a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-48892'; +$wp_version = '5.6-alpha-48894'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.