Skip to:
Content

bbPress.org

Changeset 1201


Ignore:
Timestamp:
03/03/2008 11:40:26 PM (19 years ago)
Author:
sambauers
Message:

Allow socket connections under MySQLi. Fixes #762. Props livibetter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-includes/db-mysqli.php

    r989 r1201  
    3434                        $server->pass =     constant('USER_BBDB_PASSWORD');
    3535                        $server->host =     constant('USER_BBDB_HOST');
     36                        $server->port =     null;
     37                        $server->socket =   null;
    3638                        $server->charset =  $this->user_charset;
    3739                } else { // just us
     
    4143                        $server->pass =     defined('BBDB_PASSWORD') ? constant('BBDB_PASSWORD') : false;
    4244                        $server->host =     defined('BBDB_HOST')     ? constant('BBDB_HOST')     : false;
     45                        $server->port =     null;
     46                        $server->socket =   null;
    4347                        $server->charset =  $this->charset;
    4448                }
    4549               
    4650                // Set the port if it is specified in the host
    47                 if (strpos($server->host, ':') === false) {
    48                         $server->port = null;
    49                 } else {
     51                if (strpos($server->host, ':') !== false) {
    5052                        list($server->host, $server->port) = explode(':', $server->host);
     53                        // Make it a socket if it's not numeric
     54                        if (!is_numeric($server->port)) {
     55                                $server->socket = $server->port;
     56                                $server->port = null;
     57                        }
    5158                }
    5259               
     
    5865                $this->timer_start();
    5966               
    60                 $this->$dbhname = @mysqli_connect( $server->host, $server->user, $server->pass, null, $server->port );
     67                $this->$dbhname = @mysqli_connect( $server->host, $server->user, $server->pass, null, $server->port, $server->socket );
    6168               
    6269                if (!$this->$dbhname)
Note: See TracChangeset for help on using the changeset viewer.