From: Aaron Schulz Date: Fri, 23 Sep 2016 05:24:08 +0000 (-0700) Subject: Make newExternalLB() public to match newMainLB() X-Git-Tag: 1.31.0-rc.0~5357^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=2da4c6a63cb3fb4a6f701e133e8239f0175fb080;p=lhc%2Fweb%2Fwiklou.git Make newExternalLB() public to match newMainLB() Change-Id: I7e46c947882c5de6e4d25a7110c2a2558df7ad76 --- 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; }