From: Aaron Schulz Date: Wed, 10 Jul 2019 06:51:43 +0000 (-0700) Subject: objectcache: rename "slaveOnly" parameter to "replicaOnly" in SQLBagOStuff X-Git-Tag: 1.34.0-rc.0~1088 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=65b4b61284a011fb7b1dcd5f8284078c4b438250;p=lhc%2Fweb%2Fwiklou.git objectcache: rename "slaveOnly" parameter to "replicaOnly" in SQLBagOStuff Also removed redundant check Change-Id: I9f454eb15f223f5a9816dca4510c1a9add540b49 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 65b23d574d..b247c88a84 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2416,11 +2416,11 @@ $wgObjectCaches = [ 'class' => ReplicatedBagOStuff::class, 'readFactory' => [ 'class' => SqlBagOStuff::class, - 'args' => [ [ 'slaveOnly' => true ] ] + 'args' => [ [ 'replicaOnly' => true ] ] ], 'writeFactory' => [ 'class' => SqlBagOStuff::class, - 'args' => [ [ 'slaveOnly' => false ] ] + 'args' => [ [ 'replicaOnly' => false ] ] ], 'loggroup' => 'SQLBagOStuff', 'reportDupes' => false diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 8bc053d01e..7fa0bfaf4e 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -110,7 +110,7 @@ class SqlBagOStuff extends BagOStuff { * MySQL bugs 61735 * and 61736 . * - * - slaveOnly: Whether to only use replica DBs and avoid triggering + * - replicaOnly: Whether to only use replica DBs and avoid triggering * garbage collection logic of expired items. This only * makes sense if the primary DB is used and only if get() * calls will be used. This is used by ReplicatedBagOStuff. @@ -162,7 +162,8 @@ class SqlBagOStuff extends BagOStuff { if ( isset( $params['syncTimeout'] ) ) { $this->syncTimeout = $params['syncTimeout']; } - $this->replicaOnly = !empty( $params['slaveOnly'] ); + // Backwards-compatibility for < 1.34 + $this->replicaOnly = $params['replicaOnly'] ?? ( $params['slaveOnly'] ?? false ); } /** @@ -609,8 +610,6 @@ class SqlBagOStuff extends BagOStuff { if ( // Random purging is enabled $this->purgePeriod && - // This is not using a replica DB - !$this->replicaOnly && // Only purge on one in every $this->purgePeriod writes mt_rand( 0, $this->purgePeriod - 1 ) == 0 && // Avoid repeating the delete within a few seconds