summaryrefslogtreecommitdiff
path: root/includes/db/LBFactory_Multi.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/db/LBFactory_Multi.php')
-rw-r--r--includes/db/LBFactory_Multi.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/includes/db/LBFactory_Multi.php b/includes/db/LBFactory_Multi.php
index 61e56e78..b7977a21 100644
--- a/includes/db/LBFactory_Multi.php
+++ b/includes/db/LBFactory_Multi.php
@@ -53,13 +53,16 @@ class LBFactory_Multi extends LBFactory {
var $conf, $mainLBs = array(), $extLBs = array();
var $lastWiki, $lastSection;
+ /**
+ * @param $conf array
+ */
function __construct( $conf ) {
$this->chronProt = new ChronologyProtector;
$this->conf = $conf;
$required = array( 'sectionsByDB', 'sectionLoads', 'serverTemplate' );
$optional = array( 'groupLoadsBySection', 'groupLoadsByDB', 'hostsByName',
'externalLoads', 'externalTemplateOverrides', 'templateOverridesByServer',
- 'templateOverridesByCluster', 'masterTemplateOverrides',
+ 'templateOverridesByCluster', 'masterTemplateOverrides',
'readOnlyBySection' );
foreach ( $required as $key ) {
@@ -83,6 +86,10 @@ class LBFactory_Multi extends LBFactory {
}
}
+ /**
+ * @param $wiki bool|string
+ * @return string
+ */
function getSectionForWiki( $wiki = false ) {
if ( $this->lastWiki === $wiki ) {
return $this->lastSection;
@@ -99,7 +106,7 @@ class LBFactory_Multi extends LBFactory {
}
/**
- * @param $wiki string
+ * @param $wiki bool|string
* @return LoadBalancer
*/
function newMainLB( $wiki = false ) {
@@ -116,7 +123,7 @@ class LBFactory_Multi extends LBFactory {
}
/**
- * @param $wiki
+ * @param $wiki bool|string
* @return LoadBalancer
*/
function getMainLB( $wiki = false ) {
@@ -165,6 +172,9 @@ class LBFactory_Multi extends LBFactory {
/**
* Make a new load balancer object based on template and load array
*
+ * @param $template
+ * @param $loads array
+ * @param $groupLoads
* @return LoadBalancer
*/
function newLoadBalancer( $template, $loads, $groupLoads ) {
@@ -172,7 +182,7 @@ class LBFactory_Multi extends LBFactory {
$servers = $this->makeServerArray( $template, $loads, $groupLoads );
$lb = new LoadBalancer( array(
'servers' => $servers,
- 'masterWaitTimeout' => $wgMasterWaitTimeout
+ 'masterWaitTimeout' => $wgMasterWaitTimeout
));
return $lb;
}
@@ -180,6 +190,9 @@ class LBFactory_Multi extends LBFactory {
/**
* Make a server array as expected by LoadBalancer::__construct, using a template and load array
*
+ * @param $template
+ * @param $loads array
+ * @param $groupLoads
* @return array
*/
function makeServerArray( $template, $loads, $groupLoads ) {
@@ -220,6 +233,8 @@ class LBFactory_Multi extends LBFactory {
/**
* Take a group load array indexed by group then server, and reindex it by server then group
+ * @param $groupLoads
+ * @return array
*/
function reindexGroupLoads( $groupLoads ) {
$reindexed = array();
@@ -233,6 +248,8 @@ class LBFactory_Multi extends LBFactory {
/**
* Get the database name and prefix based on the wiki ID
+ * @param $wiki bool
+ * @return array
*/
function getDBNameAndPrefix( $wiki = false ) {
if ( $wiki === false ) {
@@ -247,6 +264,8 @@ class LBFactory_Multi extends LBFactory {
* Execute a function for each tracked load balancer
* The callback is called with the load balancer as the first parameter,
* and $params passed as the subsequent parameters.
+ * @param $callback
+ * @param $params array
*/
function forEachLB( $callback, $params = array() ) {
foreach ( $this->mainLBs as $lb ) {