Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/314875
Change subject: Database and LoadBalancer documentation updates
......................................................................
Database and LoadBalancer documentation updates
Replace deprecated function calls
Change-Id: Id7e4136d7258abb61117fff73d51766954605737
---
M includes/EchoDbFactory.php
1 file changed, 10 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/75/314875/1
diff --git a/includes/EchoDbFactory.php b/includes/EchoDbFactory.php
index 2ec9de1..7cf6ed7 100644
--- a/includes/EchoDbFactory.php
+++ b/includes/EchoDbFactory.php
@@ -1,4 +1,5 @@
<?php
+use MediaWiki\MediaWikiServices;
/**
* Database factory class, this will determine whether to use the main database
@@ -47,9 +48,9 @@
protected function getLB() {
// Use the external db defined for Echo
if ( $this->cluster ) {
- $lb = wfGetLBFactory()->getExternalLB( $this->cluster );
+ $lb =
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getExternalLB(
$this->cluster );
} else {
- $lb = wfGetLB();
+ $lb =
MediaWikiServices::getInstance()->getDBLoadBalancer();
}
return $lb;
@@ -60,9 +61,9 @@
*/
protected function getSharedLB() {
if ( $this->sharedCluster ) {
- $lb = wfGetLBFactory()->getExternalLB(
$this->sharedCluster );
+ $lb =
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getExternalLB(
$this->sharedCluster );
} else {
- $lb = wfGetLB();
+ $lb =
MediaWikiServices::getInstance()->getDBLoadBalancer();
}
return $lb;
@@ -72,7 +73,7 @@
* Get the database connection for Echo
* @param $db int Index of the connection to get
* @param $groups mixed Query groups.
- * @return DatabaseBase
+ * @return IDatabase
*/
public function getEchoDb( $db, $groups = array() ) {
return $this->getLB()->getConnection( $db, $groups );
@@ -81,7 +82,7 @@
/**
* @param $db int Index of the connection to get
* @param array $groups Query groups
- * @return bool|DatabaseBase false if no shared db is configured
+ * @return bool|IDatabase false if no shared db is configured
*/
public function getSharedDb( $db, $groups = array() ) {
if ( !$this->shared ) {
@@ -90,8 +91,6 @@
return $this->getSharedLB()->getConnection( $db, $groups,
$this->shared );
}
-
-
/**
* Wrapper function for wfGetDB, some extensions like MobileFrontend is
@@ -103,7 +102,7 @@
* @param $db int Index of the connection to get
* @param $groups mixed Query groups.
* @param $wiki string|bool The wiki ID, or false for the current wiki
- * @return DatabaseBase
+ * @return IDatabase
*/
public static function getDB( $db, $groups = array(), $wiki = false ) {
global $wgEchoCluster;
@@ -136,7 +135,7 @@
'wikiDb' => false,
'echoDb' => false,
);
- $lb = wfGetLB();
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
if ( $lb->getServerCount() > 1 ) {
$position['wikiDb'] = $lb->getMasterPos();
};
@@ -160,7 +159,7 @@
*/
public function waitFor( array $position ) {
if ( $position['wikiDb'] ) {
- wfGetLB()->waitFor( $position['wikiDb'] );
+
MediaWikiServices::getInstance()->getDBLoadBalancer()->waitFor(
$position['wikiDb'] );
}
if ( $position['echoDb'] ) {
$this->getLB()->waitFor( $position['echoDb'] );
--
To view, visit https://gerrit.wikimedia.org/r/314875
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7e4136d7258abb61117fff73d51766954605737
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits