Mglaser has uploaded a new change for review.
https://gerrit.wikimedia.org/r/119735
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
default and would break all existing sites using mysqli on standard port.
This change is IPv6 safe.
Bug: 58153
Change-Id: I58e690ef2803e205f324a142fbcbd96cc87510f1
---
M includes/db/DatabaseMysqli.php
1 file changed, 12 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/35/119735/1
diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php
index 7761abe..0ec5431 100644
--- a/includes/db/DatabaseMysqli.php
+++ b/includes/db/DatabaseMysqli.php
@@ -51,6 +51,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;
@@ -70,7 +81,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/119735
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I58e690ef2803e205f324a142fbcbd96cc87510f1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_22
Gerrit-Owner: Mglaser <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits