Make WordPress Core


Ignore:
Timestamp:
08/26/2023 01:01:05 PM (13 months ago)
Author:
johnbillion
Message:

Database: Remove support for the mysql extension.

The mysql extension is no longer used in PHP 7 or above. There's a good amount of conditional code in wpdb and the health checks that can be removed now that only the mysqli functions are used.

Fixes #59118

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r56346 r56475  
    856856
    857857        // Populate the database debug fields.
    858         if ( is_resource( $wpdb->dbh ) ) {
    859             // Old mysql extension.
    860             $extension = 'mysql';
    861         } elseif ( is_object( $wpdb->dbh ) ) {
     858        if ( is_object( $wpdb->dbh ) ) {
    862859            // mysqli or PDO.
    863860            $extension = get_class( $wpdb->dbh );
     
    869866        $server = $wpdb->get_var( 'SELECT VERSION()' );
    870867
    871         if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
    872             $client_version = $wpdb->dbh->client_info;
    873         } else {
    874             // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved
    875             if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
    876                 $client_version = $matches[0];
    877             } else {
    878                 $client_version = null;
    879             }
    880         }
     868        $client_version = $wpdb->dbh->client_info;
    881869
    882870        $info['wp-database']['fields']['extension'] = array(
Note: See TracChangeset for help on using the changeset viewer.