Site Health: Bump the recommended MySQL and MariaDB versions.

* MySQL 5.6 has reached EOL (“End of Life”) in February 2021. The recommended minimum is bumped to 5.7 for now.
* MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.

This commit brings the Site Health recommendations in line with `readme.html`.

Includes:
* Adding two unit tests to ensure the SQL server versions recommended by Site Health match `readme.html`.
* Consistently declaring the recommended and required versions as the `WP_Site_Health` class properties.
* Renaming some pre-existing private properties for clarity.

Follow-up to [44986], [52319], [52358], [52420], [52424], [53431], [53433], [53435], [meta11407], [meta11866].

See #55791, #meta5999, #meta6322.
Built from https://develop.svn.wordpress.org/trunk@54069


git-svn-id: http://core.svn.wordpress.org/trunk@53628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-09-05 15:20:09 +00:00
parent c6c02c9dc6
commit b43dcea01e
2 changed files with 16 additions and 17 deletions

View File

@ -10,13 +10,14 @@
class WP_Site_Health {
private static $instance = null;
private $mysql_min_version_check;
private $mysql_rec_version_check;
private $is_acceptable_mysql_version;
private $is_recommended_mysql_version;
public $is_mariadb = false;
private $mysql_server_version = '';
private $health_check_mysql_required_version = '5.5';
private $health_check_mysql_rec_version = '';
public $is_mariadb = false;
private $mysql_server_version = '';
private $mysql_required_version = '5.5';
private $mysql_recommended_version = '5.7';
private $mariadb_recommended_version = '10.3';
public $php_memory_limit;
@ -209,15 +210,13 @@ class WP_Site_Health {
$this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
$this->health_check_mysql_rec_version = '5.6';
if ( stristr( $mysql_server_type, 'mariadb' ) ) {
$this->is_mariadb = true;
$this->health_check_mysql_rec_version = '10.0';
$this->is_mariadb = true;
$this->mysql_recommended_version = $this->mariadb_recommended_version;
}
$this->mysql_min_version_check = version_compare( '5.5', $this->mysql_server_version, '<=' );
$this->mysql_rec_version_check = version_compare( $this->health_check_mysql_rec_version, $this->mysql_server_version, '<=' );
$this->is_acceptable_mysql_version = version_compare( $this->mysql_required_version, $this->mysql_server_version, '<=' );
$this->is_recommended_mysql_version = version_compare( $this->mysql_recommended_version, $this->mysql_server_version, '<=' );
}
/**
@ -1197,7 +1196,7 @@ class WP_Site_Health {
$db_dropin = file_exists( WP_CONTENT_DIR . '/db.php' );
if ( ! $this->mysql_rec_version_check ) {
if ( ! $this->is_recommended_mysql_version ) {
$result['status'] = 'recommended';
$result['label'] = __( 'Outdated SQL server' );
@ -1208,12 +1207,12 @@ class WP_Site_Health {
/* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server recommended version number. */
__( 'For optimal performance and security reasons, you should consider running %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
( $this->is_mariadb ? 'MariaDB' : 'MySQL' ),
$this->health_check_mysql_rec_version
$this->mysql_recommended_version
)
);
}
if ( ! $this->mysql_min_version_check ) {
if ( ! $this->is_acceptable_mysql_version ) {
$result['status'] = 'critical';
$result['label'] = __( 'Severely outdated SQL server' );
@ -1225,7 +1224,7 @@ class WP_Site_Health {
/* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server minimum version number. */
__( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
( $this->is_mariadb ? 'MariaDB' : 'MySQL' ),
$this->health_check_mysql_required_version
$this->mysql_required_version
)
);
}

View File

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