Ticket #42812: 42812.diff
File 42812.diff, 1.7 KB (added by , 7 years ago) |
---|
-
src/wp-includes/wp-db.php
class wpdb { 581 581 * 582 582 * @global string $wp_version 583 583 * 584 584 * @param string $dbuser MySQL database user 585 585 * @param string $dbpassword MySQL database password 586 586 * @param string $dbname MySQL database name 587 587 * @param string $dbhost MySQL database host 588 588 */ 589 589 public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { 590 590 register_shutdown_function( array( $this, '__destruct' ) ); 591 591 592 592 if ( WP_DEBUG && WP_DEBUG_DISPLAY ) { 593 593 $this->show_errors(); 594 594 } 595 595 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 602 597 if ( function_exists( 'mysqli_connect' ) ) { 598 $this->use_mysqli = true; 599 603 600 if ( defined( 'WP_USE_EXT_MYSQL' ) ) { 604 601 $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;609 602 } 610 603 } 611 604 612 605 $this->dbuser = $dbuser; 613 606 $this->dbpassword = $dbpassword; 614 607 $this->dbname = $dbname; 615 608 $this->dbhost = $dbhost; 616 609 617 610 // wp-config.php creation will manually connect when ready. 618 611 if ( defined( 'WP_SETUP_CONFIG' ) ) { 619 612 return; 620 613 } 621 614 622 615 $this->db_connect(); 623 616 }