From 2da4c6a63cb3fb4a6f701e133e8239f0175fb080 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 22 Sep 2016 22:24:08 -0700 Subject: [PATCH] Make newExternalLB() public to match newMainLB() Change-Id: I7e46c947882c5de6e4d25a7110c2a2558df7ad76 --- includes/libs/rdbms/lbfactory/LBFactory.php | 12 +++++++++++- includes/libs/rdbms/lbfactory/LBFactoryMulti.php | 2 +- includes/libs/rdbms/lbfactory/LBFactorySimple.php | 2 +- includes/libs/rdbms/lbfactory/LBFactorySingle.php | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php index aa932aadac..fd89f336db 100644 --- a/includes/libs/rdbms/lbfactory/LBFactory.php +++ b/includes/libs/rdbms/lbfactory/LBFactory.php @@ -157,6 +157,11 @@ abstract class LBFactory { * Create a new load balancer object. The resulting object will be untracked, * not chronology-protected, and the caller is responsible for cleaning it up. * + * This method is for only advanced usage and callers should almost always use + * getMainLB() instead. This method can be useful when a table is used as a key/value + * store. In that cases, one might want to query it in autocommit mode (DBO_TRX off) + * but still use DBO_TRX transaction rounds on other tables. + * * @param bool|string $domain Domain ID, or false for the current domain * @return ILoadBalancer */ @@ -175,11 +180,16 @@ abstract class LBFactory { * untracked, not chronology-protected, and the caller is responsible for * cleaning it up. * + * This method is for only advanced usage and callers should almost always use + * getExternalLB() instead. This method can be useful when a table is used as a + * key/value store. In that cases, one might want to query it in autocommit mode + * (DBO_TRX off) but still use DBO_TRX transaction rounds on other tables. + * * @param string $cluster External storage cluster, or false for core * @param bool|string $domain Domain ID, or false for the current domain * @return ILoadBalancer */ - abstract protected function newExternalLB( $cluster, $domain = false ); + abstract public function newExternalLB( $cluster, $domain = false ); /** * Get a cached (tracked) load balancer for external storage diff --git a/includes/libs/rdbms/lbfactory/LBFactoryMulti.php b/includes/libs/rdbms/lbfactory/LBFactoryMulti.php index 25e1fe022e..6993dacfb3 100644 --- a/includes/libs/rdbms/lbfactory/LBFactoryMulti.php +++ b/includes/libs/rdbms/lbfactory/LBFactoryMulti.php @@ -261,7 +261,7 @@ class LBFactoryMulti extends LBFactory { * @throws InvalidArgumentException * @return LoadBalancer */ - protected function newExternalLB( $cluster, $domain = false ) { + public function newExternalLB( $cluster, $domain = false ) { if ( !isset( $this->externalLoads[$cluster] ) ) { throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" ); } diff --git a/includes/libs/rdbms/lbfactory/LBFactorySimple.php b/includes/libs/rdbms/lbfactory/LBFactorySimple.php index 4ed4347af7..610052f50c 100644 --- a/includes/libs/rdbms/lbfactory/LBFactorySimple.php +++ b/includes/libs/rdbms/lbfactory/LBFactorySimple.php @@ -97,7 +97,7 @@ class LBFactorySimple extends LBFactory { * @return LoadBalancer * @throws InvalidArgumentException */ - protected function newExternalLB( $cluster, $domain = false ) { + public function newExternalLB( $cluster, $domain = false ) { if ( !isset( $this->externalClusters[$cluster] ) ) { throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"." ); } diff --git a/includes/libs/rdbms/lbfactory/LBFactorySingle.php b/includes/libs/rdbms/lbfactory/LBFactorySingle.php index 4beb5d85ea..af4a350035 100644 --- a/includes/libs/rdbms/lbfactory/LBFactorySingle.php +++ b/includes/libs/rdbms/lbfactory/LBFactorySingle.php @@ -73,7 +73,7 @@ class LBFactorySingle extends LBFactory { * @param bool|string $wiki Wiki ID, or false for the current wiki * @return LoadBalancerSingle */ - protected function newExternalLB( $cluster, $wiki = false ) { + public function newExternalLB( $cluster, $wiki = false ) { return $this->lb; } -- 2.20.1