Martineznovo has uploaded a new change for review. https://gerrit.wikimedia.org/r/160212
Change subject: Make MySQLi work with non-standard socket ...................................................................... Make MySQLi work with non-standard socket MySQLi needs to specify the socket location as a parameter, and not as part of the hostname. Split the socket out of the hostname if it contains *one* colon (IPv6 safe) after checking for the port number. Conflicts: includes/db/DatabaseMysqli.php Bug: 65998 Change-Id: I66ee34e1029bc1630669bde4272d0eae9d3fd9f1 --- M RELEASE-NOTES-1.23 M includes/db/DatabaseMysqli.php 2 files changed, 18 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/12/160212/1 diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 9bb0e7c..d626737 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -1,6 +1,14 @@ Security reminder: MediaWiki does not require PHP's register_globals. If you have it on, turn it '''off''' if you can. +== MediaWiki 1.23.4 == + +This is a maintenance release of the MediaWiki 1.23 branch. + +=== Changes since 1.23.3 === + +* (bug 65998) Make MySQLi work with non-standard socket. + == MediaWiki 1.23.3 == This is a maintenance release of the MediaWiki 1.23 branch. diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php index 8c9b06c..fd3932f 100644 --- a/includes/db/DatabaseMysqli.php +++ b/includes/db/DatabaseMysqli.php @@ -58,14 +58,22 @@ } // Other than mysql_connect, mysqli_real_connect expects an explicit port - // parameter. So we need to parse the port out of $realServer + // and socket parameters. So we need to parse the port and socket out of + // $realServer $port = null; + $socket = null; $hostAndPort = IP::splitHostAndPort( $realServer ); if ( $hostAndPort ) { $realServer = $hostAndPort[0]; if ( $hostAndPort[1] ) { $port = $hostAndPort[1]; } + } elseif ( substr_count( $realServer, ':' ) == 1 ) { + // If we have a colon and something that's not a port number + // inside the hostname, assume it's the socket location + $hostAndSocket = explode( ':', $realServer ); + $realServer = $hostAndSocket[0]; + $socket = $hostAndSocket[1]; } $connFlags = 0; @@ -94,7 +102,7 @@ usleep( 1000 ); } if ( $mysqli->real_connect( $realServer, $this->mUser, - $this->mPassword, $this->mDBname, $port, null, $connFlags ) + $this->mPassword, $this->mDBname, $port, $socket, $connFlags ) ) { return $mysqli; } -- To view, visit https://gerrit.wikimedia.org/r/160212 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66ee34e1029bc1630669bde4272d0eae9d3fd9f1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_23 Gerrit-Owner: Martineznovo <martinezn...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits