Skip to:
Content

BuddyPress.org

Ticket #9210: proposed-new-9210.01.patch

File proposed-new-9210.01.patch, 2.6 KB (added by emaralive, 4 months ago)

Proposed New Patch

  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index b0b1a3cd3..ba8d6994f 100644
    function bp_get_deprecated_functions_versions() { 
    49754975                return $deprecated_functions_versions;
    49764976        }
    49774977
     4978        // Allow development version of BuddyPress to load deprecated functions the same as production version.
     4979        $bypass = (bool) apply_filters( 'bypass_bp_source_subdirectory_check', false );
     4980
    49784981        /*
    49794982         * Unless the `BP_IGNORE_DEPRECATED` constant is used & set to false, the development
    4980          * version of BuddyPress do not load deprecated functions.
     4983         * version of BuddyPress do not load deprecated functions, except when 'bypass_bp_source_subdirectory_check'
     4984         * is true.
    49814985         */
    4982         if ( defined( 'BP_SOURCE_SUBDIRECTORY' ) && BP_SOURCE_SUBDIRECTORY === 'src' ) {
     4986        if ( defined( 'BP_SOURCE_SUBDIRECTORY' ) && BP_SOURCE_SUBDIRECTORY === 'src' && ! $bypass ) {
    49834987                return array();
    49844988        }
    49854989
    function bp_get_deprecated_functions_versions() { 
    50115015                        }
    50125016                }
    50135017
    5014                 // Load 12.0 deprecated functions only when BP was installed with 12.0 or 14.0.
    5015                 if ( in_array( $initial_version, array( 12.0, 14.0 ) ) ) {
     5018                // Load 12.0 deprecated functions only when BP was installed with 12.0, 14.0 or 15.0.
     5019                if ( in_array( $initial_version, array( 12.0, 14.0, 15.0 ) ) ) {
    50165020                        return array( 12.0 );
    50175021                }
    50185022
    50195023                return array();
    50205024        }
    50215025
    5022         $index_first_major = array_search( $initial_version, $deprecated_functions_versions, true );
    5023         if ( false === $index_first_major ) {
    5024                 return array_splice( $deprecated_functions_versions, -2 );
    5025         }
    5026 
    5027         $latest_deprecated_functions_versions = array_splice( $deprecated_functions_versions, $index_first_major );
    5028 
    5029         if ( 2 <= count( $latest_deprecated_functions_versions ) ) {
    5030                 $latest_deprecated_functions_versions = array_splice( $latest_deprecated_functions_versions, -2 );
    5031         }
    5032 
    5033         $index_initial_version = array_search( $initial_version, $latest_deprecated_functions_versions, true );
    5034         if ( false !== $index_initial_version ) {
    5035                 unset( $latest_deprecated_functions_versions[ $index_initial_version ] );
    5036         }
    5037 
    5038         if ( $initial_version < 15.0 ) {
    5039                 $latest_deprecated_functions_versions = array_merge( array( 12.0 ), $latest_deprecated_functions_versions );
     5026        if ( (float) 15 >= $current_major_version ) {
     5027                $keep_last = count( $deprecated_functions_versions ) - array_search( 12.0, $deprecated_functions_versions, true );
     5028        } else {
     5029                $keep_last = 2;
    50405030        }
    50415031
    5042         return $latest_deprecated_functions_versions;
     5032        // Only load deprecated functions determined by $keep_last.
     5033        return array_splice( $deprecated_functions_versions, -$keep_last );
    50435034}
    50445035
    50455036/**