Make WordPress Core


Ignore:
Timestamp:
12/12/2017 05:42:12 AM (9 years ago)
Author:
dd32
Message:

WPDB: Always use mysqli when available.

This change makes WordPress use mysqli on PHP <5.5 when available, instead of only in PHP 5.5+ and development installs.

WPDB includes a fallback to mysql in the event that the database connection fails with mysqli so incompatibilities should be few and far between.

Fixes #42812 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r42343 r42388  
    594594                }
    595595
    596                 /* Use ext/mysqli if it exists and:
    597                  *  - WP_USE_EXT_MYSQL is defined as false, or
    598                  *  - We are a development version of WordPress, or
    599                  *  - We are running PHP 5.5 or greater, or
    600                  *  - ext/mysql is not loaded.
    601                  */
     596                // Use ext/mysqli if it exists unless WP_USE_EXT_MYSQL is defined as true
    602597                if ( function_exists( 'mysqli_connect' ) ) {
     598                        $this->use_mysqli = true;
     599
    603600                        if ( defined( 'WP_USE_EXT_MYSQL' ) ) {
    604601                                $this->use_mysqli = ! WP_USE_EXT_MYSQL;
    605                         } elseif ( version_compare( phpversion(), '5.5', '>=' ) || ! function_exists( 'mysql_connect' ) ) {
    606                                 $this->use_mysqli = true;
    607                         } elseif ( false !== strpos( $GLOBALS['wp_version'], '-' ) ) {
    608                                 $this->use_mysqli = true;
    609602                        }
    610603                }
Note: See TracChangeset for help on using the changeset viewer.