Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/22/2024 03:50:51 AM (16 months ago)
Author:
imath
Message:

Use the current major version to decide about deprecated code to load

Using the current version in case of a minor version was preventing deprecated code to be loaded when this minor version was used to first activate BuddyPress.

Props vapvarun, emaralive

See #9075 (trunk)
Closes https://github.com/buddypress/buddypress/pull/219

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r13682 r13705  
    48474847    // List of versions containing deprecated functions.
    48484848    $deprecated_functions_versions = array(
    4849         '1.2',
    4850         '1.5',
    4851         '1.6',
    4852         '1.7',
    4853         '1.9',
    4854         '2.0',
    4855         '2.1',
    4856         '2.2',
    4857         '2.3',
    4858         '2.4',
    4859         '2.5',
    4860         '2.6',
    4861         '2.7',
    4862         '2.8',
    4863         '2.9',
    4864         '3.0',
    4865         '4.0',
    4866         '6.0',
    4867         '7.0',
    4868         '8.0',
    4869         '9.0',
    4870         '10.0',
    4871         '11.0',
    4872         '12.0',
     4849        1.2,
     4850        1.5,
     4851        1.6,
     4852        1.7,
     4853        1.9,
     4854        2.0,
     4855        2.1,
     4856        2.2,
     4857        2.3,
     4858        2.4,
     4859        2.5,
     4860        2.6,
     4861        2.7,
     4862        2.8,
     4863        2.9,
     4864        3.0,
     4865        4.0,
     4866        6.0,
     4867        7.0,
     4868        8.0,
     4869        9.0,
     4870        10.0,
     4871        11.0,
     4872        12.0,
    48734873    );
    48744874
     
    48944894     */
    48954895    $initial_version        = (float) bp_get_initial_version();
    4896     $current_version        = (float) bp_get_version();
    4897     $load_latest_deprecated = $initial_version < $current_version;
     4896    $current_major_version  = (float) bp_get_major_version( bp_get_version() );
     4897    $load_latest_deprecated = $initial_version < $current_major_version;
    48984898
    48994899    // New installs.
     
    49054905                    function( $file ) {
    49064906                        if ( false !== strpos( $file, '.php' ) ) {
    4907                             return str_replace( '.php', '', $file );
     4907                            return (float) str_replace( '.php', '', $file );
    49084908                        };
    49094909                    },
     
    49184918
    49194919        // Only load 12.0 deprecated functions.
    4920         return array( '12.0' );
    4921     }
    4922 
    4923     // Try to get the first major version that was in used when BuddyPress was fist installed.
    4924     $first_major = '';
    4925     if ( $initial_version ) {
    4926         $first_major = bp_get_major_version( $initial_version );
    4927     }
    4928 
    4929     $index_first_major = array_search( $first_major, $deprecated_functions_versions, true );
     4920        return array( 12.0 );
     4921    }
     4922
     4923    $index_first_major = array_search( $initial_version, $deprecated_functions_versions, true );
    49304924    if ( false === $index_first_major ) {
    49314925        return array_splice( $deprecated_functions_versions, -2 );
     
    49384932    }
    49394933
    4940     $index_initial_version = array_search( $first_major, $latest_deprecated_functions_versions, true );
     4934    $index_initial_version = array_search( $initial_version, $latest_deprecated_functions_versions, true );
    49414935    if ( false !== $index_initial_version ) {
    49424936        unset( $latest_deprecated_functions_versions[ $index_initial_version ] );
Note: See TracChangeset for help on using the changeset viewer.