mirror of
git://develop.git.wordpress.org/
synced 2025-03-22 13:00:29 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52199 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
11e1a295b6
commit
902fd83cf4
@ -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,51 +1684,27 @@ 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' );
|
||||
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.9', '<' ) ) {
|
||||
$deactivated_gutenberg['gutenberg'] = array(
|
||||
'plugin_name' => 'Gutenberg',
|
||||
'version_deactivated' => GUTENBERG_VERSION,
|
||||
'version_compatible' => '11.9',
|
||||
);
|
||||
if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
|
||||
$deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
|
||||
$deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
|
||||
update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
|
||||
} else {
|
||||
$deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
|
||||
$deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
|
||||
update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
|
||||
}
|
||||
deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ) {
|
||||
$deactivated_gutenberg['gutenberg'] = array(
|
||||
'plugin_name' => 'Gutenberg',
|
||||
'version_deactivated' => GUTENBERG_VERSION,
|
||||
'version_compatible' => $compatible_version,
|
||||
);
|
||||
if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
|
||||
$deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
|
||||
$deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
|
||||
update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
|
||||
} else {
|
||||
$deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
|
||||
$deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
|
||||
update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
|
||||
}
|
||||
deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user