* Made wfWaitForSlaves() use it instead of using isOpen() incorrectly.
The index for the master is 0, not DB_MASTER. This fixes
2979f0b6.
Change-Id: I48e5c7f10d8fe6b8bf6e830282352e3238b5d3ae
// bug 27975 - Don't try to wait for slaves if there are none
// Prevents permission error when getting master position
if ( $lb->getServerCount() > 1 ) {
- if ( $ifWritesSince && !$lb->isOpen( DB_MASTER ) ) {
+ if ( $ifWritesSince && !$lb->hasMasterConnection() ) {
return; // assume no writes done
}
$dbw = $lb->getConnection( DB_MASTER, array(), $wiki );
}
}
+ /**
+ * @return bool Whether a master connection is already open
+ * @since 1.24
+ */
+ function hasMasterConnection() {
+ return $this->isOpen( $this->getWriterIndex() );
+ }
+
/**
* Determine if there are any pending changes that need to be rolled back
* or committed.