mediawiki-extensions-Echo/includes/EchoDbFactory.php
Kunal Mehta d139b75020 Fix phpdoc comments
Change-Id: I2f22838aa6c2c46fbd570b01c2fb118cd8c58790
2013-10-08 13:56:24 -07:00

32 lines
746 B
PHP

<?php
/**
* Database factory class, this will determine whether to use the main database
* or an external database defined in configuration file
*/
class MWEchoDbFactory {
/**
* Wrapper function for wfGetDB
*
* @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
*/
public static function getDB( $db, $groups = array(), $wiki = false ) {
global $wgEchoCluster;
// Use the external db defined for Echo
if ( $wgEchoCluster ) {
$lb = wfGetLBFactory()->getExternalLB( $wgEchoCluster, $wiki );
} else {
$lb = wfGetLB( $wiki );
}
return $lb->getConnection( $db, $groups, $wiki );
}
}