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.
Built from https://develop.svn.wordpress.org/trunk@51180


git-svn-id: http://core.svn.wordpress.org/trunk@50789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-06-18 12:14:01 +00:00
parent 7369505689
commit 4ccc58801d
2 changed files with 15 additions and 2 deletions

View File

@ -1384,9 +1384,12 @@ function update_core( $from, $to ) {
// Remove any Genericons example.html's from the filesystem. // Remove any Genericons example.html's from the filesystem.
_upgrade_422_remove_genericons(); _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(); _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. // Upgrade DB with separate request.
/** This filter is documented in wp-admin/includes/update-core.php */ /** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); 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 ); 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 );
}
}

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-beta2-51179'; $wp_version = '5.8-beta2-51180';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.