jenkins-bot has submitted this change and it was merged. Change subject: Fix repo connection for SqlSubscriptionManager ......................................................................
Fix repo connection for SqlSubscriptionManager Bug: T88333 Change-Id: Id6fcccdd3e83b252b487028b90b0ceb1963a618c --- M client/includes/store/sql/ConnectionManager.php M client/includes/store/sql/DirectSqlStore.php 2 files changed, 28 insertions(+), 5 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/client/includes/store/sql/ConnectionManager.php b/client/includes/store/sql/ConnectionManager.php index 38fdd6f..f650ec2 100644 --- a/client/includes/store/sql/ConnectionManager.php +++ b/client/includes/store/sql/ConnectionManager.php @@ -14,24 +14,44 @@ class ConnectionManager { /** - * @param LoadBalancer $loadBalancer + * @var LoadBalancer */ - public function __construct( LoadBalancer $loadBalancer ) { + private $loadBalancer; + + /** + * @var string|null + */ + private $dbName; + + /** + * @param LoadBalancer $loadBalancer + * @param string|null $dbName Optional, defaults to current wiki. + */ + public function __construct( LoadBalancer $loadBalancer, $dbName = null ) { $this->loadBalancer = $loadBalancer; + $this->dbName = $dbName; } /** * @return IDatabase */ public function getReadConnection() { - return $this->loadBalancer->getConnection( DB_READ ); + if ( $this->dbName === null ) { + return $this->loadBalancer->getConnection( DB_READ ); + } + + return $this->loadBalancer->getConnection( DB_READ, array(), $this->dbName ); } /** * @return IDatabase */ private function getWriteConnection() { - return $this->loadBalancer->getConnection( DB_WRITE ); + if ( $this->dbName === null ) { + return $this->loadBalancer->getConnection( DB_WRITE ); + } + + return $this->loadBalancer->getConnection( DB_WRITE, array(), $this->dbName ); } /** diff --git a/client/includes/store/sql/DirectSqlStore.php b/client/includes/store/sql/DirectSqlStore.php index d8feac4..0d7265d 100644 --- a/client/includes/store/sql/DirectSqlStore.php +++ b/client/includes/store/sql/DirectSqlStore.php @@ -173,7 +173,10 @@ if ( $this->useLegacyChangesSubscription ) { $this->subscriptionManager = new NullSubscriptionManager(); } else { - $connectionManager = new ConnectionManager( $this->getRepoLoadBalancer() ); + $connectionManager = new ConnectionManager( + $this->getRepoLoadBalancer(), + $this->repoWiki + ); $this->subscriptionManager = new SqlSubscriptionManager( $connectionManager ); } } -- To view, visit https://gerrit.wikimedia.org/r/188202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id6fcccdd3e83b252b487028b90b0ceb1963a618c Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits