X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fsql.php;h=e7988feccf6bebc628f5d8bc9d887664bbb6ca89;hb=278227608808c25242c87a7092da5fb9adc50cde;hp=21d8b2dd45c695e1878368060b555031ae48684a;hpb=553c6c41977de0979e3699f041910c3ff91f6452;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/sql.php b/maintenance/sql.php index 21d8b2dd45..e7988feccf 100644 --- a/maintenance/sql.php +++ b/maintenance/sql.php @@ -67,7 +67,7 @@ class MwSql extends Maintenance { $replicaDB = $this->getOption( 'replicadb', $this->getOption( 'slave', '' ) ); if ( $replicaDB === 'any' ) { $index = DB_REPLICA; - } elseif ( $replicaDB != '' ) { + } elseif ( $replicaDB !== '' ) { $index = null; $serverCount = $lb->getServerCount(); for ( $i = 0; $i < $serverCount; ++$i ) { @@ -76,7 +76,7 @@ class MwSql extends Maintenance { break; } } - if ( $index === null ) { + if ( $index === null || $index === $lb->getWriterIndex() ) { $this->fatalError( "No replica DB server configured with the name '$replicaDB'." ); } } else { @@ -175,9 +175,9 @@ class MwSql extends Maintenance { return $this->sqlPrintResult( $res, $db ); } catch ( DBQueryError $e ) { if ( $dieOnError ) { - $this->fatalError( $e ); + $this->fatalError( (string)$e ); } else { - $this->error( $e ); + $this->error( (string)$e ); } } return null;