X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2FLBFactory_Multi.php;h=3043946a6a60017c4093b8fa195b5a496c7b6265;hb=fe020896bd48989ef81427a60509307c9e1b65bf;hp=6008813ba135451988ef7e973fa58bfd663fc394;hpb=5e786b47f08747b27970f57330c3e5eab0791c47;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/LBFactory_Multi.php b/includes/db/LBFactory_Multi.php index 6008813ba1..3043946a6a 100644 --- a/includes/db/LBFactory_Multi.php +++ b/includes/db/LBFactory_Multi.php @@ -21,7 +21,6 @@ * @ingroup Database */ - /** * A multi-wiki, multi-master factory for Wikimedia and similar installations. * Ignores the old configuration globals @@ -70,6 +69,7 @@ class LBFactory_Multi extends LBFactory { /** * @param $conf array + * @throws MWException */ function __construct( $conf ) { $this->chronProt = new ChronologyProtector; @@ -82,7 +82,7 @@ class LBFactory_Multi extends LBFactory { foreach ( $required as $key ) { if ( !isset( $conf[$key] ) ) { - throw new MWException( __CLASS__.": $key is required in configuration" ); + throw new MWException( __CLASS__ . ": $key is required in configuration" ); } $this->$key = $conf[$key]; } @@ -145,21 +145,22 @@ class LBFactory_Multi extends LBFactory { $section = $this->getSectionForWiki( $wiki ); if ( !isset( $this->mainLBs[$section] ) ) { $lb = $this->newMainLB( $wiki, $section ); - $this->chronProt->initLB( $lb ); $lb->parentInfo( array( 'id' => "main-$section" ) ); + $this->chronProt->initLB( $lb ); $this->mainLBs[$section] = $lb; } return $this->mainLBs[$section]; } /** - * @param $cluster - * @param $wiki + * @param string $cluster + * @param bool $wiki + * @throws MWException * @return LoadBalancer */ function newExternalLB( $cluster, $wiki = false ) { if ( !isset( $this->externalLoads[$cluster] ) ) { - throw new MWException( __METHOD__.": Unknown cluster \"$cluster\"" ); + throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" ); } $template = $this->serverTemplate; if ( isset( $this->externalTemplateOverrides ) ) { @@ -180,6 +181,7 @@ class LBFactory_Multi extends LBFactory { if ( !isset( $this->extLBs[$cluster] ) ) { $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $wiki ); $this->extLBs[$cluster]->parentInfo( array( 'id' => "ext-$cluster" ) ); + $this->chronProt->initLB( $this->extLBs[$cluster] ); } return $this->extLBs[$cluster]; } @@ -295,6 +297,9 @@ class LBFactory_Multi extends LBFactory { foreach ( $this->mainLBs as $lb ) { $this->chronProt->shutdownLB( $lb ); } + foreach ( $this->extLBs as $extLB ) { + $this->chronProt->shutdownLB( $extLB ); + } $this->chronProt->shutdown(); $this->commitMasterChanges(); }