Skip to:
Content

BuddyPress.org

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#9075 closed defect (bug) (fixed)

When first activating BuddyPress with 12.1.1, 12.0.0 deprecated functions are not loaded

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 12.2.0 Priority: highest
Severity: major Version: 12.0.0
Component: Core Keywords: has-patch has-unit-tests commit
Cc:

Description

If we forced 12.0.0 deprecated functions to be loaded on first install, we missed the fact, installing BuddyPress for the first time with 12.1.1 or another minor release from the 12.0.0 branch is not including these 😱. This ​support reply made me check & notice this.

Attachments (1)

buddypress-12-2-0-beta.zip​ (2.8 MB) - added by imath 9 months ago.

Change History (17)

#1 @vapvarun
9 months ago

can be improved with updating bp_get_deprecated_functions_versions()

 $is_new_install = $initial_version === $current_version;

    // For new installs, return only the latest version's deprecated functions.
    if ( $is_new_install ) {
        return array( end($deprecated_functions_versions) );
    }

or like this
If BP_LOAD_DEPRECATED is not set or set to false, the function returns only the latest version's deprecated functions, which aligns with the original logic for a first-time install.

 $is_new_install = $initial_version === $current_version;

// For new installs, if BP_LOAD_DEPRECATED is true, load all deprecated versions including 12.0.0.
    if ( $is_new_install ) {
        if ( defined( 'BP_LOAD_DEPRECATED' ) && BP_LOAD_DEPRECATED ) {
            return $deprecated_functions_versions; // Return all deprecated versions.
        }
        return array( end($deprecated_functions_versions) ); // Else, return only the latest version.
    }

#2 @imath
9 months ago

  • Priority changed from high to highest
  • Severity changed from normal to major

The problem is more that $initial_version is always a major release. So the $current_version should be used to find the corresponding major version.

Our logic for new installs was to avoid loading deprecated functions. We changed it for 12.0.0 because we rightly thought it will take more time for 3rd party plugins or themes developer to be ready for this huge release.

Unfortunately, we haven't thought about the case when BuddyPress is first installed with a minor release.

Reading latest support replies, it looks like it's also happening when upgrading from 12.0. I need to check if it's happening when BuddyPress was first installed with 12.0 in this case or with any previous releases.

Version 0, edited 9 months ago by imath (next)

#3 @imath
9 months ago

  • Keywords needs-unit-tests added

This ticket was mentioned in ​Slack in #buddypress by imath. ​View the logs.


9 months ago

This ticket was mentioned in ​PR #219 on ​buddypress/buddypress by ​@imath.


9 months ago
#5

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
  • On install, the initial version is always set to the closest major one, so there's no need to get it again as the $first_major variable.
  • Instead of comparing initial major version with the current version, we need to use the current major version so that minor releases also includes the right deprecated function files.
  • Improve the unit test to include a check with a current minor version.

Trac ticket: ​https://buddypress.trac.wordpress.org/ticket/9075

#6 @imath
9 months ago

I think it's fixing the issue. I'll package a 12.2.0-beta release so that it's easier to test upgrading from:

  • 11.4.0
  • 12.0.0
  • 12.1.1

#7 @imath
9 months ago

  • Keywords dev-feedback added

Hi @vapvarun @emaralive & @dcavins

I've just tested this fix thanks to the attached 12.2.0-beta version (which includes it) for the following cases:

  • 11.4.0 is updated to 12.2.0-beta
  • 12.0.0 is updated to 12.2.0-beta
  • 12.1.1 is updated to 12.2.0-beta
  • fresh install of BuddyPress with 12.2.0-beta.

/wp-content/plugins/buddypress/core/deprecated/12.0.php file is always loaded and using a 12.0 deprecated function is displaying a deprecated notice.

I believe it's ok to commit it.

Just to be sure could you run the same tests and confirm it's the case for you too?
Thanks in advance.

#8 @emaralive
9 months ago

@imath - Tested 12.1.1 is updated to 12.2.0-beta and deprecated functions for 12 load.

Note: Previous state with 12.1.1 was that deprecated functions were not loading.


Tested fresh install of BuddyPress with 12.2.0-beta and:

  • deprecated functions for 12 load
  • receive Thank you for installing BuddyPress 12.0! notification in BuddyPress Settings

#9 @imath
9 months ago

Hi @emaralive Thanks a lot for your tests πŸ‘ The Admin notification happens because corresponding major version to 12.2 is 12, I think it’s a good thing as it’s a first install so the Admin needs to be aware that with 12.2 just like 12.0, if he activated 3rd party plugins not ready for BP Rewrites, then they need to get BP Classic.

#10 @imath
9 months ago

  • Keywords commit added; needs-testing dev-feedback removed

I believe we’re ready to have this in! I’ll commit the fix shortly.

#11 @emaralive
9 months ago

@imath - Ran the tests prior to looking more closely at the latest change for PR 219 and although the tests had passed, I think we need to revisit how the function
bp_get_deprecated_functions_versions() should behave. Meaning, the latest change appears to be fixing a symptom and not the root cause of which originated with version 11.0 (the not loading of deprecated functions when there is a fresh install). There was a fix for 12 beta to load the deprecated functions which again fixed a symptom and not the root cause, which is why 12.1.1 failed to load the deprecated functions.

IOW, we need a real fix for what I guess will be 12.3.0, which will give us time to reexamine the aforementioned function.

#12 @imath
9 months ago

@emaralive sure, we can always improve it maybe in 14.0.0 as it will be another scenario.

As the fix is ok for 12.x.0 minor versions, I’ll use it to quickly build 12.2.0.

Once fixed for branch 12.0, I’ll reopen the ticket for 14.0.0.

#13 @emaralive
9 months ago

@imath - Sure, it's you call.

#14 @imath
9 months ago

In 13705:

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

#15 @imath
9 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13706:

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

Fixes #9075 (branch 12.0)

This ticket was mentioned in ​Slack in #buddypress by imath. ​View the logs.


9 months ago

Note: See TracTickets for help on using tickets.