Changeset 13706
- Timestamp:
- 01/22/2024 04:06:39 AM (9 months ago)
- Location:
- branches/12.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/12.0/src/bp-core/bp-core-functions.php
r13683 r13706 4847 4847 // List of versions containing deprecated functions. 4848 4848 $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, 4873 4873 ); 4874 4874 … … 4894 4894 */ 4895 4895 $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; 4898 4898 4899 4899 // New installs. … … 4905 4905 function( $file ) { 4906 4906 if ( false !== strpos( $file, '.php' ) ) { 4907 return str_replace( '.php', '', $file );4907 return (float) str_replace( '.php', '', $file ); 4908 4908 }; 4909 4909 }, … … 4918 4918 4919 4919 // 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 ); 4930 4924 if ( false === $index_first_major ) { 4931 4925 return array_splice( $deprecated_functions_versions, -2 ); … … 4938 4932 } 4939 4933 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 ); 4941 4935 if ( false !== $index_initial_version ) { 4942 4936 unset( $latest_deprecated_functions_versions[ $index_initial_version ] ); -
branches/12.0/src/class-buddypress.php
r13700 r13706 655 655 foreach ( $deprecated_functions_versions as $deprecated_functions_version ) { 656 656 // Load all or last 2 deprecated versions. 657 require $this->plugin_dir . sprintf( 'bp-core/deprecated/%s.php', $deprecated_functions_version);657 require $this->plugin_dir . sprintf( 'bp-core/deprecated/%s.php', number_format( $deprecated_functions_version, 1 ) ); 658 658 } 659 659 } -
branches/12.0/tests/phpunit/testcases/core/functions.php
r13632 r13706 870 870 /** 871 871 * @ticket BP8687 872 * @ticket BP9075 872 873 */ 873 874 public function test_bp_get_deprecated_functions_versions() { 874 $current_version = (float)bp_get_version();875 $current_version = bp_get_version(); 875 876 $versions = bp_get_deprecated_functions_versions(); 876 877 // When current version is the initial version, we should only load 12.0 deprecated functions file. 878 $this->assertSame( $versions, array( '12.0' ), 'Please check the list of `$deprecated_functions_versions` in `bp_get_deprecated_functions_versions()`. There should be one for each file of the `/src/bp-core/deprecated` directory.' ); 877 $bp = buddypress(); 878 879 // When current major version is the initial version, we should only load 12.0 deprecated functions file. 880 $this->assertSame( $versions, array( 12.0 ), 'Please check the list of `$deprecated_functions_versions` in `bp_get_deprecated_functions_versions()`. There should be one for each file of the `/src/bp-core/deprecated` directory.' ); 881 882 $bp->version = '12.1.1'; 883 884 // We should load the 2 lasts deprecated functions files. 885 $this->bp_initial_version = '12.0'; 886 887 add_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 888 889 $versions = bp_get_deprecated_functions_versions(); 890 891 $this->assertContains( 12.0, $versions, '12.0 deprecated functions should be loaded when 12.1.1 was the first installed version.' ); 892 893 $this->bp_initial_version = '9.0'; 894 895 $versions = bp_get_deprecated_functions_versions(); 896 897 $this->assertContains( 12.0, $versions, '12.0 deprecated functions should be loaded when 12.0 was updated for a minor release' ); 898 899 remove_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 900 901 $bp->version = $current_version; 879 902 880 903 // We should load the 2 lasts deprecated functions files.
Note: See TracChangeset
for help on using the changeset viewer.