WordPress at Your Fingertips
function is not described

WP_Site_Health::prepare_sql_data() private WP 5.2.0

Run the SQL version checks.

These values are used in later tests, but the part of preparing them is more easily managed early in the class for ease of access and discovery.

{} It's a method of the class: WP_Site_Health{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->prepare_sql_data();

Notes

  • Global. wpdb. $wpdb WordPress database abstraction object.

Changelog

Since 5.2.0 Introduced.

Code of WP_Site_Health::prepare_sql_data() WP 5.8.2

private function prepare_sql_data() {
	global $wpdb;

	if ( $wpdb->use_mysqli ) {
		// phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info
		$mysql_server_type = mysqli_get_server_info( $wpdb->dbh );
	} else {
		// phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_server_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved
		$mysql_server_type = mysql_get_server_info( $wpdb->dbh );
	}

	$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->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, '<=' );
}