Remove the admin notice about the upcoming PHP 7.2 requirement

This commit is contained in:
Nestor Soriano 2022-03-28 10:45:08 +02:00
parent 7c15f83a3f
commit c8280c0aee
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
1 changed files with 1 additions and 42 deletions

View File

@ -54,13 +54,7 @@ class WC_Admin_Notices {
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'wp_loaded', array( __CLASS__, 'add_redirect_download_method_notice' ) );
add_action( 'admin_init', array( __CLASS__, 'hide_notices' ), 20 );
add_action(
'admin_init',
function() {
self::maybe_remove_php72_required_notice();
},
20
);
// @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation.
// That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want
// to avoid.
@ -122,41 +116,6 @@ class WC_Admin_Notices {
self::add_notice( 'template_files' );
self::add_min_version_notice();
self::add_maxmind_missing_license_key_notice();
self::maybe_add_php72_required_notice();
}
/**
* Add an admin notice about the bump of the required PHP version in WooCommerce 6.5
* if the current PHP version is too old.
*
* TODO: Remove this method in WooCommerce 6.5.
*/
private static function maybe_add_php72_required_notice() {
if ( version_compare( phpversion(), '7.2', '>=' ) ) {
return;
}
self::add_custom_notice(
'php72_required_in_woo_65',
__( '<h4>PHP version requirements will change soon</h4><p>WooCommerce 6.5, scheduled for <b>May 2022</b>, will require PHP 7.2 or newer to work. Your server is currently running an older version of PHP, so this change will impact your store. Upgrading to at least PHP 7.4 is recommended. <b><a href="https://developer.woocommerce.com/2022/01/05/new-requirement-for-woocommerce-6-5-php-7-2/">Learn more about this change.</a></b></p>', 'woocommerce' )
);
$wp_version_is_ok = version_compare( get_bloginfo( 'version' ), WC_NOTICE_MIN_WP_VERSION, '>=' );
if ( $wp_version_is_ok ) {
self::hide_notice( WC_PHP_MIN_REQUIREMENTS_NOTICE );
}
}
/**
* Remove the admin notice about the bump of the required PHP version in WooCommerce 6.5
* if the current PHP version is good.
*
* TODO: Remove this method in WooCommerce 6.5.
*/
private static function maybe_remove_php72_required_notice() {
if ( version_compare( phpversion(), '7.2', '>=' ) && self::has_notice( 'php72_required_in_woo_65' ) ) {
self::remove_notice( 'php72_required_in_woo_65' );
}
}
/**