Merge "Improve MapCacheLRU error message"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabaseMysqlBase.php
index 953f63d..3ecfca9 100644 (file)
@@ -96,12 +96,8 @@ abstract class DatabaseMysqlBase extends Database {
         * @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}";
@@ -109,7 +105,7 @@ abstract class DatabaseMysqlBase extends Database {
                                $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;
@@ -376,7 +372,7 @@ abstract class DatabaseMysqlBase extends Database {
 
                // 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;
@@ -502,7 +498,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * 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 );
@@ -1461,7 +1457,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * 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
         */
@@ -1515,7 +1511,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * 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
@@ -1551,7 +1547,7 @@ abstract class DatabaseMysqlBase extends Database {
         * 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
         */