Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/188363
Change subject: Fix repo connection for SqlSubscriptionManager
......................................................................
Fix repo connection for SqlSubscriptionManager
Bug: T88333
Change-Id: Id6fcccdd3e83b252b487028b90b0ceb1963a618c
(cherry picked from commit d6ae1edd08033625af43dd5c1a1e509f11f7555b)
---
M client/includes/store/sql/ConnectionManager.php
M client/includes/store/sql/DirectSqlStore.php
2 files changed, 28 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/63/188363/1
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/188363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6fcccdd3e83b252b487028b90b0ceb1963a618c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.25wmf16
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits