Skip to content

Commit

Permalink
site-health improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Sep 14, 2022
1 parent 03ca040 commit b4ec8ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class WP_Site_Health {
private $is_recommended_mysql_version;

public $is_mariadb = false;
public $is_sqlite = false;
private $mysql_server_version = '';
private $mysql_required_version = '5.5';
private $mysql_recommended_version = '5.7';
Expand Down Expand Up @@ -208,6 +209,7 @@ private function prepare_sql_data() {
global $wpdb;

$mysql_server_type = $wpdb->db_server_info();
$this->is_sqlite = defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ? 'sqlite' : 'mysql';

$this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );

Expand Down Expand Up @@ -1197,7 +1199,7 @@ public function get_test_sql_server() {

$db_dropin = file_exists( WP_CONTENT_DIR . '/db.php' );

if ( ! $this->is_recommended_mysql_version ) {
if ( ! $this->is_sqlite && ! $this->is_recommended_mysql_version ) {
$result['status'] = 'recommended';

$result['label'] = __( 'Outdated SQL server' );
Expand All @@ -1213,7 +1215,7 @@ public function get_test_sql_server() {
);
}

if ( ! $this->is_acceptable_mysql_version ) {
if ( ! $this->is_sqlite && ! $this->is_acceptable_mysql_version ) {
$result['status'] = 'critical';

$result['label'] = __( 'Severely outdated SQL server' );
Expand Down Expand Up @@ -1279,6 +1281,10 @@ public function get_test_utf8mb4_support() {
'test' => 'utf8mb4_support',
);

if ( $this->is_sqlite ) {
return $result;
}

if ( ! $this->is_mariadb ) {
if ( version_compare( $this->mysql_server_version, '5.5.3', '<' ) ) {
$result['status'] = 'recommended';
Expand Down

0 comments on commit b4ec8ea

Please sign in to comment.