* @param array $params
*/
function __construct( array $params ) {
- $this->lagDetectionMethod = isset( $params['lagDetectionMethod'] )
- ? $params['lagDetectionMethod']
- : 'Seconds_Behind_Master';
- $this->lagDetectionOptions = isset( $params['lagDetectionOptions'] )
- ? $params['lagDetectionOptions']
- : [];
+ $this->lagDetectionMethod = $params['lagDetectionMethod'] ?? 'Seconds_Behind_Master';
+ $this->lagDetectionOptions = $params['lagDetectionOptions'] ?? [];
$this->useGTIDs = !empty( $params['useGTIDs' ] );
foreach ( [ 'KeyPath', 'CertPath', 'CAFile', 'CAPath', 'Ciphers' ] as $name ) {
$var = "ssl{$name}";
$this->$var = $params[$var];
}
}
- $this->sqlMode = isset( $params['sqlMode'] ) ? $params['sqlMode'] : '';
+ $this->sqlMode = $params['sqlMode'] ?? '';
$this->utf8Mode = !empty( $params['utf8Mode'] );
$this->insertSelectIsSafe = isset( $params['insertSelectIsSafe'] )
? (bool)$params['insertSelectIsSafe'] : null;
// Unfortunately, mysql_num_rows does not reset the last errno.
// We are not checking for any errors here, since
- // these are no errors mysql_num_rows can cause.
+ // there are no errors mysql_num_rows can cause.
// See https://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
// See https://phabricator.wikimedia.org/T44430
return $n;
/**
* Returns the text of the error message from previous MySQL operation
*
- * @param resource $conn Raw connection
+ * @param resource|null $conn Raw connection
* @return string
*/
abstract protected function mysqlError( $conn = null );
/**
* List all tables on the database
*
- * @param string $prefix Only show tables with this prefix, e.g. mw_
+ * @param string|null $prefix Only show tables with this prefix, e.g. mw_
* @param string $fname Calling function name
* @return array
*/
/**
* Lists VIEWs in the database
*
- * @param string $prefix Only show VIEWs with this prefix, eg.
+ * @param string|null $prefix Only show VIEWs with this prefix, eg.
* unit_test_, or $wgDBprefix. Default: null, would return all views.
* @param string $fname Name of calling function
* @return array
* Differentiates between a TABLE and a VIEW.
*
* @param string $name Name of the TABLE/VIEW to test
- * @param string $prefix
+ * @param string|null $prefix
* @return bool
* @since 1.22
*/