X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDatabase.php;h=15e02ad0857e98caae07fb46b771278039349c71;hb=60e8a35c2d344cc22d5dc149aed10cf71f21b4c5;hp=3d40417d65d086a882d1b058b37b99838ade3271;hpb=4c2cb9ac822d13c7aa418f9960657900e55ab909;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 3d40417d65..15e02ad085 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -236,12 +236,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware /** @var TransactionProfiler */ protected $trxProfiler; - /** - * @var bool Whether writing is allowed on this connection. - * Should be false for connections to replicas. - */ - protected $allowWrite = true; - /** * Constructor and database handle and attempt to connect to the DB server * @@ -283,7 +277,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->connLogger = $params['connLogger']; $this->queryLogger = $params['queryLogger']; $this->errorLogger = $params['errorLogger']; - $this->allowWrite = empty( $params['noWrite'] ); // Set initial dummy domain until open() sets the final DB/prefix $this->currentDomain = DatabaseDomain::newUnspecified(); @@ -915,13 +908,12 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } if ( $isWrite ) { - if ( !$this->allowWrite ) { + if ( $this->getLBInfo( 'replica' ) === true ) { throw new DBError( $this, - 'Write operations are not allowed on this database connection!' + '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();