jenkins-bot has submitted this change and it was merged.
Change subject: Make MySQLi work with non-standard port
......................................................................
Make MySQLi work with non-standard port
Other than mysql_connect, mysqli_real_connect expects an explicit
port parameter. So we need to parse the port out of $realServer. Note it
is not possible to just use $wgDBport, since that is set to 5432 as a
defalt and would break all existing sites using mysqli on standard port.
This change is IPv6 safe.
Bug: 58153
Change-Id: I8fe191b930b26bce3c863b1953b237cb4a889c6e
---
M includes/db/DatabaseMysqli.php
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php
index d41f3e4..0dc1890 100644
--- a/includes/db/DatabaseMysqli.php
+++ b/includes/db/DatabaseMysqli.php
@@ -57,6 +57,17 @@
. " have you compiled PHP with the
--with-mysqli option?\n" );
}
+ // Other than mysql_connect, mysqli_real_connect expects an
explicit port
+ // parameter. So we need to parse the port out of $realServer
+ $port = null;
+ $hostAndPort = IP::splitHostAndPort( $realServer );
+ if ( $hostAndPort ) {
+ $realServer = $hostAndPort[0];
+ if ( $hostAndPort[1] ) {
+ $port = $hostAndPort[1];
+ }
+ }
+
$connFlags = 0;
if ( $this->mFlags & DBO_SSL ) {
$connFlags |= MYSQLI_CLIENT_SSL;
@@ -83,7 +94,7 @@
usleep( 1000 );
}
if ( $mysqli->real_connect( $realServer, $this->mUser,
- $this->mPassword, $this->mDBname, null, null,
$connFlags )
+ $this->mPassword, $this->mDBname, $port, null,
$connFlags )
) {
return $mysqli;
}
--
To view, visit https://gerrit.wikimedia.org/r/109634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8fe191b930b26bce3c863b1953b237cb4a889c6e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Nemith <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: PleaseStand <[email protected]>
Gerrit-Reviewer: Roycwang <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits