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


git-svn-id: http://core.svn.wordpress.org/trunk@51791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2021-11-17 17:45:00 +00:00
parent bba44bf5e5
commit d4b3deddda
2 changed files with 17 additions and 44 deletions

View File

@ -1398,9 +1398,6 @@ function update_core( $from, $to ) {
// 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();
// Deactivate the Gutenberg plugin if its version is 11.8 or lower.
_upgrade_590_force_deactivate_incompatible_plugins();
@ -1687,42 +1684,17 @@ function _upgrade_440_force_deactivate_incompatible_plugins() {
}
}
/**
* @access private
* @ignore
* @since 5.8.0
*/
function _upgrade_580_force_deactivate_incompatible_plugins() {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '10.7', '<=' ) ) {
_deactivate_gutenberg_when_incompatible_with_wp( '10.8' );
}
}
/**
* @access private
* @ignore
* @since 5.9.0
*/
function _upgrade_590_force_deactivate_incompatible_plugins() {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.8', '<=' ) ) {
_deactivate_gutenberg_when_incompatible_with_wp( '11.9' );
}
}
/**
* Deactivates the Gutenberg plugin when its version is incompatible.
*
* @access private
* @ignore
* @since 5.9.0
*
* @param string $compatible_version The version of Gutenberg plugin that is compatible.
*/
function _deactivate_gutenberg_when_incompatible_with_wp( $compatible_version ) {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.9', '<' ) ) {
$deactivated_gutenberg['gutenberg'] = array(
'plugin_name' => 'Gutenberg',
'version_deactivated' => GUTENBERG_VERSION,
'version_compatible' => $compatible_version,
'version_compatible' => '11.9',
);
if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
$deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
@ -1735,3 +1707,4 @@ function _deactivate_gutenberg_when_incompatible_with_wp( $compatible_version )
}
deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52198';
$wp_version = '5.9-alpha-52199';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.