From 4ccc58801d8c2470a22fdca802f99e84ee567d1e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 18 Jun 2021 12:14:01 +0000 Subject: [PATCH] Upgrade/Install: Deactivate the Gutenberg plugin if its version is 10.7 or lower. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- wp-admin/includes/update-core.php | 15 ++++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 6e8e3e270a..32c70a19f0 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -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 ); + } +} diff --git a/wp-includes/version.php b/wp-includes/version.php index d1864413c8..9e2340daf9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @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.