Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#54405 closed task (blessed) (fixed)

Disable Gutenberg 11.8.2 (and likely earlier) upon upgrade to WordPress 5.9

Reported by: jorbin's profile jorbin Owned by: hellofromtonya's profile hellofromTonya
Milestone: 5.9 Priority: normal
Severity: blocker Version:
Component: Upgrade/Install Keywords: has-patch commit
Focuses: Cc:

Description

Trunk isn't compatible with Gutenberg 11.8.2 since they both declare the interface WP_Theme_JSON_Schema. There is likely a need for a 590 version of _upgrade_580_force_deactivate_incompatible_plugins

Attachments (1)

54405.diff (3.3 KB) - added by hellofromTonya 3 years ago.
Removes unnecessary _upgrade_580_force_deactivate_incompatible_plugins() AND fixes the GB version comparison to trigger at < 11.8.

Download all attachments as: .zip

Change History (19)

#1 @johnbillion
3 years ago

  • Severity changed from normal to blocker
  • Type changed from defect (bug) to task (blessed)

Previously: #53432 for 5.8.

This ticket was mentioned in PR #1887 on WordPress/wordpress-develop by hellofromtonya.


3 years ago
#2

  • Keywords has-patch added; needs-patch removed

Uses the same strategy from WordPress 5.8 release to deactivate the Gutenberg plugin if its version is incompatible with 5.9. Incompatible version is 11.8.2. Compatible version set to 11.9.

As this is likely needed from release-to-release, refactored the code from 5.8 to a private core function for use in 5.8, 5.9, and future major releases.

Trac ticket: https://core.trac.wordpress.org/ticket/54405

#3 @hellofromTonya
3 years ago

  • Keywords needs-testing added

Great catch @jorbin! You're right. PR 1887 uses the strategy from 5.8. Marking for needs-testing.

#4 @hellofromTonya
3 years ago

  • Keywords commit added

Marking for commit. Should work without issue. But leaving it marked as needs-testing to follow-up after commit (i.e. hard to test without it being committed).

#5 @hellofromTonya
3 years ago

  • Owner set to hellofromTonya
  • Status changed from new to reviewing

Preparing commit. Then I'll manually test for both 5.8 and 5.9 to ensure it works as intended. Commit and then test report coming.

#6 @hellofromTonya
3 years ago

In 52165:

Upgrade/Install: Deactivate the Gutenberg plugin if its version is 11.8 or lower.

Avoid a fatal error due to WP_Theme_JSON_Schema and potentially other classes and/or functions redeclarations when updating to WordPress 5.9 with an incompatible version of the Gutenberg plugin.

This commit uses the same strategy from 5.8. Moves the plugin deactivation code (introduced in [51266]) to a private function for reuse in 5.8, 5.9, and future major releases.

Follow-up to [51180], [51266].

Props hellofromTonya, johnbillion, jorbin.
See #54405.

#8 @hellofromTonya
3 years ago

  • Keywords commit removed

Removing the commit keyword to get it out of the commit queue. Leaving open for testing and a test report (coming soon).

#9 follow-up: @TobiasBg
3 years ago

Is it actually necessary to call (and even keep) _upgrade_580_force_deactivate_incompatible_plugins() in trunk (i.e. WP 5.9+)?
If Gutenberg is so old that it would be deactivated in _upgrade_580_force_deactivate_incompatible_plugins();, it would also be deactivated by _upgrade_590_force_deactivate_incompatible_plugins(); that is called in the next line.
Thus, we can save a few if comparisons during the core upgrade, which can never hurt.

As long as _upgrade_580_force_deactivate_incompatible_plugins() stays in the WP 5.8.x branch (which it will, due to the SVN branch), everything should be fine, I believe?

(Moving the plugin deactivation code to a private function would also not really be needed then, either.)

This ticket was mentioned in Slack in #core-auto-updates by afragen. View the logs.


3 years ago

#11 in reply to: ↑ 9 @hellofromTonya
3 years ago

Replying to TobiasBg:

Is it actually necessary to call (and even keep) _upgrade_580_force_deactivate_incompatible_plugins() in trunk (i.e. WP 5.9+)?
If Gutenberg is so old that it would be deactivated in _upgrade_580_force_deactivate_incompatible_plugins();, it would also be deactivated by _upgrade_590_force_deactivate_incompatible_plugins(); that is called in the next line.
Thus, we can save a few if comparisons during the core upgrade, which can never hurt.

As long as _upgrade_580_force_deactivate_incompatible_plugins() stays in the WP 5.8.x branch (which it will, due to the SVN branch), everything should be fine, I believe?

(Moving the plugin deactivation code to a private function would also not really be needed then, either.)

Hmm, good points @TobiasBg. I agree. _upgrade_580_force_deactivate_incompatible_plugins() was deactivating Gutenberg only. As this is an upgrade for 5.9.0 (with 5.8 in a separate branch), this function can renamed for 590.

Then it can be renamed for each future release with the appropriate compatible/incompatible Gutenberg plugin versions.

@hellofromTonya
3 years ago

Removes unnecessary _upgrade_580_force_deactivate_incompatible_plugins() AND fixes the GB version comparison to trigger at < 11.8.

#12 @hellofromTonya
3 years ago

Test Report

env:

  • OS: macOS
  • localhost: Local
  • Plugins: Beta Tester, Core Rollback, Gutenberg (various versions)
  • Browser: Firefox, Chrome, Safari, Edge (though browser doesn't really matter)

Steps

Note: You can download different Gutenberg plugin versions from here https://wordpress.org/plugins/gutenberg/advanced/

  1. Start with WordPress 5.8.2
  2. Install Gutenberg 11.7 (which also has the WP_Theme_JSON_Schema interface conflict in it) and activate it
  3. Go to Tools > Beta Testing and set these settings: "Bleeding edge" and "Nightlies". Press save.
  4. Go to Dashboard > Updates
  5. Click the "Update to latest 5.9 nightly" blue button

Result: 5.9 installs, no fatal error, and Gutenberg plugin is deactivated (check by going to Plugins)

  1. Roll WordPress back to 5.8.2 by going to Dashboard > Updates and clicking the "Re-install version on 5.8.2" button.
  2. Go to Plugins and delete the Gutenberg plugin.
  3. Install and activate Gutenberg 11.8.0.
    • Click "Add New" and then "Upload Plugin". Drag and drop or select the 11.8.0 version of the Gutenberg plugin.
    • Click "Install Now".
    • Once installed, click to activate it.
  4. Repeat steps 4 and 5.

Results: Fatal error.

Bummer. Why? The version_compare() of <= 11.8 doesn't work when the version is 11.8.x. See it in action here https://3v4l.org/BGVJo.

54405.diff changes to use < 11.9 for the version_compare().

#13 follow-up: @hellofromTonya
3 years ago

@johnbillion @SergeyBiryukov @johnbillion are you okay with removing _upgrade_580_force_deactivate_incompatible_plugins()? It makes sense to me as there are no other plugins being deactivated and this function is not needed for 5.9.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 years ago

#15 @Clorith
3 years ago

I think that's fine, the new 590-function would deactivate the older version that the 580 one handled, so no need to keep both.

#16 in reply to: ↑ 13 @SergeyBiryukov
3 years ago

Replying to hellofromTonya:

are you okay with removing _upgrade_580_force_deactivate_incompatible_plugins()? It makes sense to me as there are no other plugins being deactivated and this function is not needed for 5.9.

This is an interesting precedent as we don't generally remove functions, but it seems fine in this case, and makes sense to me too. 54405.diff looks good here.

#17 @hellofromTonya
3 years ago

  • Keywords commit added; needs-testing removed

Marking for commit and will commit shortly.

#18 @hellofromTonya
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52199:

Upgrade/Install: Remove 5.8 function and fix deactivate Gutenberg plugin version compare < 11.9.

Follow-up to [52165] where the version_compare() fails for 11.8.x versions. This commit changes the version comparison to < 11.9 for deactivating the Gutenberg plugin.

The _upgrade_580_force_deactivate_incompatible_plugins() function is no longer needed in 5.9. It's redundant and unnecessary as _upgrade_590_force_deactivate_incompatible_plugins() deactivates those versions as well.

Removing _upgrade_580_force_deactivate_incompatible_plugins() and moving the deactivation logic back into the _deactivate_gutenberg_when_incompatible_with_wp(), thus removing the new private function _deactivate_gutenberg_when_incompatible_with_wp() introduced in [52165].

Follow-up [51180], [51266], [52165].

Props hellofromTonya, tobiasbg, clorith, sergeybiryukov, costdev.
Fixes #54405.

Note: See TracTickets for help on using tickets.