From 13462932aeaf811397cbd63f4b787488b25761d4 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 18 Jan 2021 18:29:02 -0300 Subject: [PATCH 1/2] Deactivate untrusted plugin's banner --- includes/admin/class-wc-admin-status.php | 2 +- includes/admin/plugin-updates/class-wc-plugin-updates.php | 7 ++++++- .../plugin-updates/class-wc-plugins-screen-updates.php | 7 ++++++- includes/admin/views/html-admin-page-status-report.php | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/admin/class-wc-admin-status.php b/includes/admin/class-wc-admin-status.php index 1742531c8c3..0092b8b4383 100644 --- a/includes/admin/class-wc-admin-status.php +++ b/includes/admin/class-wc-admin-status.php @@ -377,7 +377,7 @@ class WC_Admin_Status { private static function output_plugins_info( $plugins, $untested_plugins ) { $wc_version = Constants::get_constant( 'WC_VERSION' ); - if ( 'major' === WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE ) { + if ( 'major' === Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ) ) { // Since we're only testing against major, we don't need to show minor and patch version. $wc_version = $wc_version[0] . '.0'; } diff --git a/includes/admin/plugin-updates/class-wc-plugin-updates.php b/includes/admin/plugin-updates/class-wc-plugin-updates.php index 50ca0fc799d..bb8c40af460 100644 --- a/includes/admin/plugin-updates/class-wc-plugin-updates.php +++ b/includes/admin/plugin-updates/class-wc-plugin-updates.php @@ -150,10 +150,15 @@ class WC_Plugin_Updates { * with the $new_version. * * @param string $new_version WooCommerce version to test against. - * @param string $release 'major' or 'minor'. + * @param string $release 'major', 'minor', or 'none'. * @return array of plugin info arrays */ public function get_untested_plugins( $new_version, $release ) { + // Since 5.0 all versions are backwards compatible. + if ( 'none' === $release ) { + return array(); + } + $extensions = array_merge( $this->get_plugins_with_header( self::VERSION_TESTED_HEADER ), $this->get_plugins_for_woocommerce() ); $untested = array(); $new_version_parts = explode( '.', $new_version ); diff --git a/includes/admin/plugin-updates/class-wc-plugins-screen-updates.php b/includes/admin/plugin-updates/class-wc-plugins-screen-updates.php index ad24e66848e..5920fb52616 100644 --- a/includes/admin/plugin-updates/class-wc-plugins-screen-updates.php +++ b/includes/admin/plugin-updates/class-wc-plugins-screen-updates.php @@ -42,9 +42,14 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates { * @param stdClass $response Plugin update response. */ public function in_plugin_update_message( $args, $response ) { + $version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ); + if ( ! is_string( $version_type ) ) { + $version_type = 'none'; + } + $this->new_version = $response->new_version; $this->upgrade_notice = $this->get_upgrade_notice( $response->new_version ); - $this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, 'major' ); + $this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, $version_type ); $current_version_parts = explode( '.', Constants::get_constant( 'WC_VERSION' ) ); $new_version_parts = explode( '.', $this->new_version ); diff --git a/includes/admin/views/html-admin-page-status-report.php b/includes/admin/views/html-admin-page-status-report.php index 5b3028a11c5..97b3b6a6c01 100644 --- a/includes/admin/views/html-admin-page-status-report.php +++ b/includes/admin/views/html-admin-page-status-report.php @@ -11,7 +11,8 @@ global $wpdb; if ( ! defined( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ) ) { // Define if we're checking against major or minor versions. - define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'major' ); + // Since 5.0 all versions are backwards compatible, so there's no more check. + define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'none' ); } $report = wc()->api->get_endpoint_data( '/wc/v3/system_status' ); From 8f0237e390ac08efea493c19bc9dad945ef25ac0 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 18 Jan 2021 19:23:59 -0300 Subject: [PATCH 2/2] Update untested extensions modal notice --- .../views/html-notice-untested-extensions-modal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/plugin-updates/views/html-notice-untested-extensions-modal.php b/includes/admin/plugin-updates/views/html-notice-untested-extensions-modal.php index 23c1fe21a19..bb1c58468b1 100644 --- a/includes/admin/plugin-updates/views/html-notice-untested-extensions-modal.php +++ b/includes/admin/plugin-updates/views/html-notice-untested-extensions-modal.php @@ -18,7 +18,7 @@ $untested_plugins_msg = sprintf( ?>
-

+

@@ -41,7 +41,7 @@ $untested_plugins_msg = sprintf(
-

+