Ticket #8687: 8687.patch
File 8687.patch, 6.0 KB (added by , 3 years ago) |
---|
-
src/bp-core/bp-core-functions.php
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php index d9e4a7eab..05f39b354 100644
function bp_db_version_raw() { 70 70 return !empty( $bp->db_version_raw ) ? $bp->db_version_raw : 0; 71 71 } 72 72 73 /** 74 * Output a BuddyPress major version. 75 * 76 * @since 11.0.0 77 * 78 * @param string $version BuddyPress version. 79 */ 80 function bp_major_version( $version = '' ) { 81 echo bp_get_major_version( $version ); 82 } 83 84 /** 85 * Return a BuddyPress major version. 86 * 87 * @since 11.0.0 88 * 89 * @param string $version BuddyPress version. 90 * @return string The corresponding BuddyPress major version. 91 */ 92 function bp_get_major_version( $version = '' ) { 93 if ( ! $version ) { 94 $version = bp_get_version(); 95 } 96 97 $last_wp_like_major_versions = '2.9'; 98 $float_version = (float) $version; 99 100 if ( 1 !== version_compare( $version, $last_wp_like_major_versions ) ) { 101 $major_version = (string) $float_version; 102 } else { 103 $major_version = (int) $float_version . '.0'; 104 } 105 106 return $major_version; 107 } 108 109 /** 110 * Output the BuddyPress version used for its first install. 111 * 112 * @since 11.0.0 113 */ 114 function bp_initial_version() { 115 echo bp_get_initial_version(); 116 } 117 118 /** 119 * Return the BuddyPress version used for its first install. 120 * 121 * @since 11.0.0 122 * 123 * @return string The BuddyPress version used for its first install. 124 */ 125 function bp_get_initial_version() { 126 return bp_get_option( '_bp_initial_major_version', '0' ); 127 } 128 73 129 /** 74 130 * Check whether the current version of WP exceeds a given version. 75 131 * -
src/bp-core/bp-core-update.php
diff --git src/bp-core/bp-core-update.php src/bp-core/bp-core-update.php index 2651cc0c6..357f95614 100644
function bp_version_updater() { 205 205 206 206 // Install BP schema and activate only Activity and XProfile. 207 207 if ( bp_is_install() ) { 208 // Set the first BP major version the plugin was installed. 209 bp_update_option( '_bp_initial_major_version', bp_get_major_version() ); 208 210 209 211 // Apply schema and set Activity and XProfile components as active. 210 212 bp_core_install( $default_components ); … … function bp_core_get_10_0_upgrade_email_schema( $emails ) { 761 763 * @since 11.0.0 762 764 */ 763 765 function bp_update_to_11_0() { 766 bp_delete_option( '_bp_ignore_deprecated_code' ); 764 767 765 768 add_filter( 'bp_email_get_schema', 'bp_core_get_11_0_upgrade_email_schema' ); 766 769 -
src/class-buddypress.php
diff --git src/class-buddypress.php src/class-buddypress.php index b291d956e..da2ad772d 100644
class BuddyPress { 463 463 * @param string $value Email type taxonomy slug. 464 464 */ 465 465 $this->email_taxonomy_type = apply_filters( 'bp_email_tax_type', 'bp-email-type' ); 466 467 /** 468 * Are PHPUnit tests running? 469 * 470 * @since 11.0.0 471 * 472 * @param bool $value True if PHPUnit tests are running, false otherwise. 473 */ 474 $this->is_phpunit_running = function_exists( 'tests_add_filter' ); 466 475 } 467 476 468 477 /** … … class BuddyPress { 535 544 require $this->plugin_dir . 'bp-core/bp-core-rest-api.php'; 536 545 require $this->plugin_dir . 'bp-core/bp-core-blocks.php'; 537 546 538 // Maybe load deprecated functionality (this double negative is proof positive!). 539 if ( ! bp_get_option( '_bp_ignore_deprecated_code', ! $this->load_deprecated ) ) { 540 require $this->plugin_dir . 'bp-core/deprecated/1.2.php'; 541 require $this->plugin_dir . 'bp-core/deprecated/1.5.php'; 542 require $this->plugin_dir . 'bp-core/deprecated/1.6.php'; 543 require $this->plugin_dir . 'bp-core/deprecated/1.7.php'; 544 require $this->plugin_dir . 'bp-core/deprecated/1.9.php'; 545 require $this->plugin_dir . 'bp-core/deprecated/2.0.php'; 546 require $this->plugin_dir . 'bp-core/deprecated/2.1.php'; 547 require $this->plugin_dir . 'bp-core/deprecated/2.2.php'; 548 require $this->plugin_dir . 'bp-core/deprecated/2.3.php'; 549 require $this->plugin_dir . 'bp-core/deprecated/2.4.php'; 550 require $this->plugin_dir . 'bp-core/deprecated/2.5.php'; 551 require $this->plugin_dir . 'bp-core/deprecated/2.6.php'; 552 require $this->plugin_dir . 'bp-core/deprecated/2.7.php'; 553 require $this->plugin_dir . 'bp-core/deprecated/2.8.php'; 554 require $this->plugin_dir . 'bp-core/deprecated/2.9.php'; 555 require $this->plugin_dir . 'bp-core/deprecated/3.0.php'; 556 require $this->plugin_dir . 'bp-core/deprecated/4.0.php'; 557 require $this->plugin_dir . 'bp-core/deprecated/6.0.php'; 558 require $this->plugin_dir . 'bp-core/deprecated/7.0.php'; 559 require $this->plugin_dir . 'bp-core/deprecated/8.0.php'; 560 require $this->plugin_dir . 'bp-core/deprecated/9.0.php'; 561 require $this->plugin_dir . 'bp-core/deprecated/10.0.php'; 547 $this->load_deprecated = ! BP_IGNORE_DEPRECATED; 548 $initial_version = (float) bp_get_initial_version(); 549 $current_version = (float) bp_get_version(); 550 $load_latest_deprecated = $initial_version < $current_version; 551 552 // Maybe load deprecated functionality. 553 if ( ! $this->is_phpunit_running && ( $this->load_deprecated || $load_latest_deprecated ) ) { 554 // List of versions containing deprecated functions. 555 $deprecated_versions = array( 556 '1.2', 557 '1.5', 558 '1.6', 559 '1.7', 560 '1.9', 561 '2.0', 562 '2.1', 563 '2.2', 564 '2.3', 565 '2.4', 566 '2.5', 567 '2.6', 568 '2.7', 569 '2.8', 570 '2.9', 571 '3.0', 572 '4.0', 573 '6.0', 574 '7.0', 575 '8.0', 576 '9.0', 577 '10.0', 578 ); 579 580 foreach ( $deprecated_versions as $deprecated_version ) { 581 if ( ! $this->load_deprecated && 2 < $current_version - (float) $deprecated_version ) { 582 continue; 583 } 584 585 // Load all or last 2 deprecated versions. 586 require $this->plugin_dir . sprintf( 'bp-core/deprecated/%s.php', $deprecated_version ); 587 } 562 588 } 563 589 564 590 // Load wp-cli module if PHP 5.6+. … … class BuddyPress { 719 745 if ( 720 746 ! in_array( $component, array( 'core', 'members' ), true ) && 721 747 ! bp_is_active( $component ) && 722 ! function_exists( 'tests_add_filter' )748 ! $this->is_phpunit_running 723 749 ) { 724 750 return; 725 751 }