Remove compatibility checks for major version.

In addition to #28840, there are other places where we make use of compatibility check with major versions. I've discovered 2:
- update through /wp-admin/update-core.php
- force disabling auto-updates if there are any extensions that haven't declared their compatibility with WC 5.0

This change updates both places to be in line with the changes done in #28840.
This commit is contained in:
Peter Fabian 2021-02-23 13:27:06 +01:00
parent 35d4ee4073
commit 313ea8541c
2 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,8 @@
* @version 3.2.0
*/
use Automattic\Jetpack\Constants;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -37,8 +39,13 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
return;
}
$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
if ( ! is_string( $version_type ) ) {
$version_type = 'none';
}
$this->new_version = wc_clean( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version );
$this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, 'major' );
$this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, $version_type );
if ( ! empty( $this->major_untested_plugins ) ) {
echo $this->get_extensions_modal_warning(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped

View File

@ -2255,7 +2255,11 @@ function wc_prevent_dangerous_auto_updates( $should_update, $plugin ) {
$new_version = wc_clean( $plugin->new_version );
$plugin_updates = new WC_Plugin_Updates();
$untested_plugins = $plugin_updates->get_untested_plugins( $new_version, 'major' );
$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
if ( ! is_string( $version_type ) ) {
$version_type = 'none';
}
$untested_plugins = $plugin_updates->get_untested_plugins( $new_version, $version_type );
if ( ! empty( $untested_plugins ) ) {
return false;
}