X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2Floadbalancer%2FLBFactorySimple.php;h=1b0a1f3f554da636d8210fd79688e71a1a31c17d;hb=3e9d53bfadb9f277ba488422479c28d3444a99fd;hp=1c9e094469123bd330a3f2e74079c6262b1e0609;hpb=636f3e9282cc345d1620c9bf4dc90174168bd3dd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/loadbalancer/LBFactorySimple.php b/includes/db/loadbalancer/LBFactorySimple.php index 1c9e094469..1b0a1f3f55 100644 --- a/includes/db/loadbalancer/LBFactorySimple.php +++ b/includes/db/loadbalancer/LBFactorySimple.php @@ -28,7 +28,7 @@ class LBFactorySimple extends LBFactory { /** @var LoadBalancer */ private $mainLB; /** @var LoadBalancer[] */ - private $extLBs = array(); + private $extLBs = []; /** @var string */ private $loadMonitorClass; @@ -72,7 +72,7 @@ class LBFactorySimple extends LBFactory { $flags |= DBO_COMPRESS; } - $servers = array( array( + $servers = [ [ 'host' => $wgDBserver, 'user' => $wgDBuser, 'password' => $wgDBpassword, @@ -81,14 +81,15 @@ class LBFactorySimple extends LBFactory { 'load' => 1, 'flags' => $flags, 'master' => true - ) ); + ] ]; } - return new LoadBalancer( array( + return new LoadBalancer( [ 'servers' => $servers, 'loadMonitor' => $this->loadMonitorClass, - 'readOnlyReason' => $this->readOnlyReason - ) ); + 'readOnlyReason' => $this->readOnlyReason, + 'trxProfiler' => $this->trxProfiler + ] ); } /** @@ -98,7 +99,7 @@ class LBFactorySimple extends LBFactory { public function getMainLB( $wiki = false ) { if ( !isset( $this->mainLB ) ) { $this->mainLB = $this->newMainLB( $wiki ); - $this->mainLB->parentInfo( array( 'id' => 'main' ) ); + $this->mainLB->parentInfo( [ 'id' => 'main' ] ); $this->chronProt->initLB( $this->mainLB ); } @@ -117,11 +118,12 @@ class LBFactorySimple extends LBFactory { throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" ); } - return new LoadBalancer( array( + return new LoadBalancer( [ 'servers' => $wgExternalServers[$cluster], 'loadMonitor' => $this->loadMonitorClass, - 'readOnlyReason' => $this->readOnlyReason - ) ); + 'readOnlyReason' => $this->readOnlyReason, + 'trxProfiler' => $this->trxProfiler + ] ); } /** @@ -132,7 +134,7 @@ class LBFactorySimple extends LBFactory { public function &getExternalLB( $cluster, $wiki = false ) { if ( !isset( $this->extLBs[$cluster] ) ) { $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $wiki ); - $this->extLBs[$cluster]->parentInfo( array( 'id' => "ext-$cluster" ) ); + $this->extLBs[$cluster]->parentInfo( [ 'id' => "ext-$cluster" ] ); $this->chronProt->initLB( $this->extLBs[$cluster] ); } @@ -147,12 +149,12 @@ class LBFactorySimple extends LBFactory { * @param callable $callback * @param array $params */ - public function forEachLB( $callback, array $params = array() ) { + public function forEachLB( $callback, array $params = [] ) { if ( isset( $this->mainLB ) ) { - call_user_func_array( $callback, array_merge( array( $this->mainLB ), $params ) ); + call_user_func_array( $callback, array_merge( [ $this->mainLB ], $params ) ); } foreach ( $this->extLBs as $lb ) { - call_user_func_array( $callback, array_merge( array( $lb ), $params ) ); + call_user_func_array( $callback, array_merge( [ $lb ], $params ) ); } } @@ -160,6 +162,6 @@ class LBFactorySimple extends LBFactory { if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { $this->shutdownChronologyProtector( $this->chronProt ); } - $this->commitMasterChanges(); // sanity + $this->commitMasterChanges( __METHOD__ ); // sanity } }