Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316801

Change subject: Add caching of Cargo DB instance
......................................................................

Add caching of Cargo DB instance

Change-Id: Ib1ac8daf23dd1346a14d32aba3e8b2dc7c840b94
---
M CargoUtils.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/01/316801/2

diff --git a/CargoUtils.php b/CargoUtils.php
index 8d9076a..191597b 100644
--- a/CargoUtils.php
+++ b/CargoUtils.php
@@ -20,6 +20,10 @@
         * @return Database
         */
        public static function getDB() {
+               if ( self::$CargoDB != null && self::$CargoDB->isOpen() ) {
+                       return self::$CargoDB;
+               }
+
                global $wgDBuser, $wgDBpassword, $wgDBprefix;
                global $wgCargoDBserver, $wgCargoDBname, $wgCargoDBuser, 
$wgCargoDBpassword, $wgCargoDBtype;
                $dbw = wfGetDB( DB_MASTER );
@@ -47,7 +51,8 @@
                        'tablePrefix' => $dbTablePrefix,
                ];
 
-               return Database::factory( $wgCargoDBtype, $params );
+               self::$CargoDB = Database::factory( $wgCargoDBtype, $params );
+               return self::$CargoDB;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/316801
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1ac8daf23dd1346a14d32aba3e8b2dc7c840b94
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to