Make WordPress Core

Ticket #21663: 21663.17.diff

File 21663.17.diff, 1.1 KB (added by pento, 11 years ago)
  • src/wp-includes/wp-db.php

     
    549549        private $use_mysqli = false;
    550550
    551551        /**
     552         * Whether we've managed to successfully connect at some point
     553         *
     554         * @since 3.9.0
     555         * @access private
     556         * @var bool
     557         */
     558        private $has_connected = false;
     559
     560        /**
    552561         * Connects to the database server and selects a database
    553562         *
    554563         * PHP5 style constructor for compatibility with PHP5. Does
     
    13361345
    13371346                        if ( $this->dbh->connect_errno ) {
    13381347                                $this->dbh = null;
     1348
     1349                                // Something went wrong with the mysqli connect.
     1350                                // If this is the first connection attempt, we should try
     1351                                // to fallback to ext/mysql.
     1352                                if ( ! $this->has_connected ) {
     1353                                        $this->use_mysqli = false;
     1354                                        $this->db_connect();
     1355                                }
    13391356                        }
    13401357                } else {
    13411358                        if ( WP_DEBUG ) {
     
    13671384
    13681385                        return false;
    13691386                } else if ( $this->dbh ) {
     1387                        $this->has_connected = true;
    13701388                        $this->set_charset( $this->dbh );
    13711389                        $this->set_sql_mode();
    13721390                        $this->ready = true;