Commit 839ceb98 authored by Andrew Nacin's avatar Andrew Nacin
Browse files

Use mysqli for WordPress development versions, regardless of PHP version, to...

Use mysqli for WordPress development versions, regardless of PHP version, to increase testing footprint.

Allow the lack of ext/mysql to pass wp_check_php_mysql_versions().

see #21663.

Built from https://develop.svn.wordpress.org/trunk@27257


git-svn-id: https://core.svn.wordpress.org/trunk@27114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 12446af8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ function wp_check_php_mysql_versions() {
		die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
	}

	if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
	if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
		wp_load_translations_early();
		die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
	}
+12 −1
Original line number Diff line number Diff line
@@ -568,7 +568,18 @@ class wpdb {
		if ( WP_DEBUG && WP_DEBUG_DISPLAY )
			$this->show_errors();

		$this->use_mysqli = ( version_compare( phpversion(), '5.5', '>=' ) && function_exists( 'mysqli_connect' ) );
		/* Use ext/mysqli if it exists and:
		 *  - We are a development version of WordPress, or
		 *  - We are running PHP 5.5 or greater, or
		 *  - ext/mysql is not loaded.
		 */
		if ( function_exists( 'mysqli_connect' ) ) {
			if ( version_compare( phpversion(), '5.5', '>=' ) || ! function_exists( 'mysql_connect' ) ) {
				$this->use_mysqli = true;
			} elseif ( false !== strpos( $GLOBALS['wp_version'], '-' ) ) {
				$this->use_mysqli = true;
			}
		}

		$this->init_charset();