, MySQL- host:port:socket, localhost:3306:/var/lib/mysock.
mediawiki-1.22.6, . localhost , MySQL , .
php mediawiki-1.22.6, host:port:socket.
: , , , , , localhost:/var/lib/mysock.
, .
IP.php Includes public static function splitHostAndPort( $both ), real_connect() protected function mysqlConnect( $realServer ), DatabaseMysqli.php /db.
splitHostAndPort() :
public static function splitHostAndPort( $both ) {
if ( substr( $both, 0, 1 ) === '[' ) {
if ( preg_match( '/^\[(' . RE_IPV6_ADD . ')\](?::(?P<port>\d+))?$/', $both, $m ) ) {
if ( isset( $m['port'] ) ) {
return array( $m[1], intval( $m['port'] ) );
} else {
return array( $m[1], false );
}
} else {
return false;
}
}
$numColons = substr_count( $both, ':' );
if ( $numColons >= 2 ) {
if ( preg_match( '/^' . RE_IPV6_ADD . '$/', $both ) ) {
return array( $both, false );
} else {
}
}
if ( $numColons >= 1 ) {
$bits = explode( ':', $both );
if ( preg_match( '/^\d+/', $bits[1] ) ) {
if ($numColons > 1) {
return array( $bits[0], intval( $bits[1] ), $bits[2] );
} else {
return array( $bits[0], intval( $bits[1] ) );
}
} else {
return false;
}
}
return array( $both, false );
}
mysqlConnect(), , , :
$socketname = $port = null;
$hostAndPort = IP::splitHostAndPort( $realServer );
if ( $hostAndPort ) {
$realServer = $hostAndPort[0];
if ( $hostAndPort[1] ) {
$port = $hostAndPort[1];
}
if ( $hostAndPort[2] ) {
$socketname = $hostAndPort[2];
}
}
real_connect(),
if ( $mysqli->real_connect( $realServer, $this->mUser,
$this->mPassword, $this->mDBname, $port, $socketname, $connFlags ) )