From: Aaron Schulz Date: Thu, 22 Aug 2019 00:35:02 +0000 (-0700) Subject: maintenance: Sanity check that --replicadb isn't using the master in sql.php X-Git-Tag: 1.34.0-rc.0~608^2 X-Git-Url: http://git.cyclocoop.org/images/a/a9/%28?a=commitdiff_plain;h=2f8e07cfcbb7b84f5aa32d8694e660e9d6e260b7;p=lhc%2Fweb%2Fwiklou.git maintenance: Sanity check that --replicadb isn't using the master in sql.php Change-Id: I0b7fd896c88b06cbc17b31b1ae2b9cb8e375da1b --- diff --git a/maintenance/sql.php b/maintenance/sql.php index 21d8b2dd45..612c09264c 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 {