if ( !$error ) {
$error = $this->lastError();
}
- wfLogDBError( "Error connecting to {$this->mServer}: $error\n" );
+ wfLogDBError( "Error connecting to {$this->mServer}: $error" );
wfDebug( "DB connection error\n" .
"Server: $server, User: $user, Password: " .
substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
$success = $this->selectDB( $dbName );
wfRestoreWarnings();
if ( !$success ) {
- wfLogDBError( "Error selecting database $dbName on server {$this->mServer}\n" );
+ wfLogDBError( "Error selecting database $dbName on server {$this->mServer}" );
wfDebug( "Error selecting database $dbName on server {$this->mServer} " .
"from client host " . wfHostname() . "\n" );
}
/**
- * @deprecated in 1.19, use getLagFromSlaveStatus
+ * @deprecated since 1.19, use getLagFromSlaveStatus
*
* @return bool|int
*/
* @return string
*/
public function getSoftwareLink() {
+ // MariaDB includes its name in its version string (sent when the connection is opened),
+ // and this is how MariaDB's version of the mysql command-line client identifies MariaDB
+ // servers (see the mariadb_connection() function in libmysql/libmysql.c).
$version = $this->getServerVersion();
- if ( strpos( $version, 'MariaDB' ) !== false ) {
+ if ( strpos( $version, 'MariaDB' ) !== false || strpos( $version, '-maria-' ) !== false ) {
return '[{{int:version-db-mariadb-url}} MariaDB]';
- } elseif ( strpos( $version, 'percona' ) !== false ) {
- return '[{{int:version-db-percona-url}} Percona Server]';
- } else {
- return '[{{int:version-db-mysql-url}} MySQL]';
}
+
+ // Percona Server's version suffix is not very distinctive, and @@version_comment
+ // doesn't give the necessary info for source builds, so assume the server is MySQL.
+ // (Even Percona's version of mysql doesn't try to make the distinction.)
+ return '[{{int:version-db-mysql-url}} MySQL]';
}
/**
if ( !count( $rows ) ) {
return true; // nothing to do
}
- $rows = is_array( reset( $rows ) ) ? $rows : array( $rows );
+
+ if ( !is_array( reset( $rows ) ) ) {
+ $rows = array( $rows );
+ }
$table = $this->tableName( $table );
$columns = array_keys( $rows[0] );