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

This avoids a fatal error due to `WP_Block_Template` class redeclaration when updating to WordPress 5.8 with an older version of Gutenberg activated.

Follow-up to [35582] for the REST API plugin.

Props hellofromTonya, oglekler, azaozz, desrosj, pbiron, jorbin, youknowriad, TimothyBlynJacobs, Clorith, markparnell.
See #53432.

git-svn-id: https://develop.svn.wordpress.org/trunk@51180 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-06-18 12:12:57 +00:00
parent 5267e4a40c
commit c264ba80df

View File

@ -1384,9 +1384,12 @@ function update_core( $from, $to ) {
// Remove any Genericons example.html's from the filesystem.
_upgrade_422_remove_genericons();
// Remove the REST API plugin if its version is Beta 4 or lower.
// Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
_upgrade_440_force_deactivate_incompatible_plugins();
// Deactivate the Gutenberg plugin if its version is 10.7 or lower.
_upgrade_580_force_deactivate_incompatible_plugins();
// Upgrade DB with separate request.
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Upgrading database…' ) );
@ -1662,3 +1665,13 @@ function _upgrade_440_force_deactivate_incompatible_plugins() {
deactivate_plugins( array( 'rest-api/plugin.php' ), true );
}
}
/**
* @ignore
* @since 5.8.0
*/
function _upgrade_580_force_deactivate_incompatible_plugins() {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '10.7', '<=' ) ) {
deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
}
}