Make DB handles inherit configured read-only mode
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 10 Oct 2015 00:22:14 +0000 (17:22 -0700)
committerOri.livneh <ori@wikimedia.org>
Tue, 20 Oct 2015 23:27:14 +0000 (23:27 +0000)
commit52010e6d21d8bdefa1c89fbc9421850185cc5011
tree4ae7d345e069d8bfac55e712722d0025bed50d63
parentc51a7425bfe24969c484c74f0bc71d85307de78a
Make DB handles inherit configured read-only mode

LBFactory inherits $wgReadOnly, the LBs inherit
any LBFactory read only mode, and Database objects
inherit any LB read-only mode.

Add some methods callers can use to check if
a DB/LB handle is read-only before trying writes.

Additionally:
* Fix 5ec1e47475 regression where readOnlyBySection
  read-only mode would not affect wfReadOnly() but only
  lagged-slave read-only mode for LBFactoryMulti.
* Catch errors when getLaggedSlaveMode() is called after
  master connection and object is established.
* Make getLaggedSlaveMode() a no-op if there are no slaves.
* Make string/false logic for read-only consistent everywhere.
* Remove mLaggedSlaveMode "m" prefix.

Change-Id: Ice3224caae564aa5ffb41b424c23d1593229117a
includes/GlobalFunctions.php
includes/db/Database.php
includes/db/loadbalancer/LBFactory.php
includes/db/loadbalancer/LBFactoryMulti.php
includes/db/loadbalancer/LBFactorySimple.php
includes/db/loadbalancer/LBFactorySingle.php
includes/db/loadbalancer/LoadBalancer.php