}
if ( $isWrite ) {
+ if ( $this->getLBInfo( 'replica' ) === true ) {
+ throw new DBError(
+ $this,
+ 'Write operations are not allowed on replica database connections.'
+ );
+ }
# In theory, non-persistent writes are allowed in read-only mode, but due to things
# like https://bugs.mysql.com/bug.php?id=33669 that might not work anyway...
$reason = $this->getReadOnlyReason();
* @see WANObjectCache::getWithSetCallback()
*
* @param IDatabase $db1
- * @param IDatabase $dbs,...
+ * @param IDatabase $db2 [optional]
* @return array Map of values:
* - lag: highest lag of any of the DBs or false on error (e.g. replication stopped)
* - since: oldest UNIX timestamp of any of the DB lag estimates
* - pending: whether any of the DBs have uncommitted changes
+ * @throws DBError
* @since 1.27
*/
- public static function getCacheSetOptions( IDatabase $db1 ) {
+ public static function getCacheSetOptions( IDatabase $db1, IDatabase $db2 = null ) {
$res = [ 'lag' => 0, 'since' => INF, 'pending' => false ];
foreach ( func_get_args() as $db ) {
/** @var IDatabase $db */