Make WordPress Core


Ignore:
Timestamp:
08/27/2020 09:30:33 PM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r48856 r48894  
    139139 *
    140140 * @since 5.5.0
    141  * @since 5.5.1 The 'local' type was added.
     141 * @since 5.5.1 Added the 'local' type.
     142 * @since 5.5.1 Removed the ability to alter the list of types.
    142143 *
    143144 * @return string The current environment type.
     
    157158        );
    158159
    159         // Check if the environment variable has been set, if `getenv` is available on the system.
    160         if ( function_exists( 'getenv' ) ) {
    161                 $has_env = getenv( 'WP_ENVIRONMENT_TYPES' );
    162                 if ( false !== $has_env ) {
    163                         $wp_environments = explode( ',', $has_env );
    164                 }
    165         }
    166 
    167         // Fetch the environment types from a constant, this overrides the global system variable.
    168         if ( defined( 'WP_ENVIRONMENT_TYPES' ) ) {
    169                 $wp_environments = WP_ENVIRONMENT_TYPES;
     160        // Add a note about the deprecated WP_ENVIRONMENT_TYPES constant.
     161        if ( defined( 'WP_ENVIRONMENT_TYPES' ) && function_exists( '_deprecated_argument' ) ) {
     162                _deprecated_argument(
     163                        'define()',
     164                        '5.5.1',
     165                        /* translators: %s: WP_ENVIRONMENT_TYPES */
     166                        sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' )
     167                );
    170168        }
    171169
Note: See TracChangeset for help on using the changeset viewer.