protected $lagDetectionOptions = [];
/** @var bool bool Whether to use GTID methods */
protected $useGTIDs = false;
-
+ /** @var string|null */
+ protected $sslKeyPath;
+ /** @var string|null */
+ protected $sslCertPath;
+ /** @var string|null */
+ protected $sslCAPath;
+ /** @var string[]|null */
+ protected $sslCiphers;
/** @var string|null */
private $serverVersion = null;
* ID of this server's master will be used. Set the "conds" field to
* override the query conditions, e.g. ['shard' => 's1'].
* - useGTIDs : use GTID methods like MASTER_GTID_WAIT() when possible.
+ * - sslKeyPath : path to key file [default: null]
+ * - sslCertPath : path to certificate file [default: null]
+ * - sslCAPath : parth to certificate authority PEM files [default: null]
+ * - sslCiphers : array list of allowable ciphers [default: null]
* @param array $params
*/
function __construct( array $params ) {
? $params['lagDetectionOptions']
: [];
$this->useGTIDs = !empty( $params['useGTIDs' ] );
+ foreach ( [ 'KeyPath', 'CertPath', 'CAPath', 'Ciphers' ] as $name ) {
+ $var = "ssl{$name}";
+ if ( isset( $params[$var] ) ) {
+ $this->$var = $params[$var];
+ }
+ }
}
/**
$socket = $hostAndSocket[1];
}
+ $mysqli = mysqli_init();
+
$connFlags = 0;
if ( $this->mFlags & DBO_SSL ) {
$connFlags |= MYSQLI_CLIENT_SSL;
+ $mysqli->ssl_set(
+ $this->sslKeyPath,
+ $this->sslCertPath,
+ null,
+ $this->sslCAPath,
+ $this->sslCiphers
+ );
}
if ( $this->mFlags & DBO_COMPRESS ) {
$connFlags |= MYSQLI_CLIENT_COMPRESS;
$realServer = 'p:' . $realServer;
}
- $mysqli = mysqli_init();
if ( $wgDBmysql5 ) {
// Tell the server we're communicating with it in UTF-8.
// This may engage various charset conversions.