[wp-trac] [WordPress Trac] #56484: Site Health: Use $wpdb->db_server_info() to retrieve database server type

WordPress Trac noreply at wordpress.org
Wed Aug 31 23:42:21 UTC 2022


#56484: Site Health: Use $wpdb->db_server_info() to retrieve database server type
----------------------------------------+---------------------
 Reporter:  SergeyBiryukov              |       Owner:  (none)
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  6.1
Component:  Site Health                 |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+---------------------
Description changed by SergeyBiryukov:

Old description:

> `WP_Site_Health::prepare_sql_data()` has this fragment, introduced in
> [44986] / #46573:
> {{{
> 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 can be replaced with:
> {{{
> $mysql_server_type = $wpdb->db_server_info();
> }}}
>
> The `db_server_info()` method has the exact same code and is available as
> of [47451] / #40037].

New description:

 `WP_Site_Health::prepare_sql_data()` has this fragment, introduced in
 [44986] / #46573:
 {{{
 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 can be replaced with:
 {{{
 $mysql_server_type = $wpdb->db_server_info();
 }}}

 The `db_server_info()` method has the exact same code and is available as
 of [47451] / #40037.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56484#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list