Added a separate error message for mkdir failures
[lhc/web/wiklou.git] / includes / db / loadbalancer / LBFactorySimple.php
index e328727..53b0310 100644 (file)
@@ -29,8 +29,6 @@ class LBFactorySimple extends LBFactory {
        private $mainLB;
        /** @var LoadBalancer[] */
        private $extLBs = array();
-       /** @var ChronologyProtector */
-       private $chronProt;
 
        /** @var string */
        private $loadMonitorClass;
@@ -38,7 +36,6 @@ class LBFactorySimple extends LBFactory {
        public function __construct( array $conf ) {
                parent::__construct( $conf );
 
-               $this->chronProt = new ChronologyProtector;
                $this->loadMonitorClass = isset( $conf['loadMonitorClass'] )
                        ? $conf['loadMonitorClass']
                        : null;
@@ -89,7 +86,9 @@ class LBFactorySimple extends LBFactory {
 
                return new LoadBalancer( array(
                        'servers' => $servers,
-                       'loadMonitor' => $this->loadMonitorClass
+                       'loadMonitor' => $this->loadMonitorClass,
+                       'readOnlyReason' => $this->readOnlyReason,
+                       'trxProfiler' => $this->trxProfiler
                ) );
        }
 
@@ -121,7 +120,9 @@ class LBFactorySimple extends LBFactory {
 
                return new LoadBalancer( array(
                        'servers' => $wgExternalServers[$cluster],
-                       'loadMonitor' => $this->loadMonitorClass
+                       'loadMonitor' => $this->loadMonitorClass,
+                       'readOnlyReason' => $this->readOnlyReason,
+                       'trxProfiler' => $this->trxProfiler
                ) );
        }
 
@@ -157,14 +158,10 @@ class LBFactorySimple extends LBFactory {
                }
        }
 
-       public function shutdown() {
-               if ( $this->mainLB ) {
-                       $this->chronProt->shutdownLB( $this->mainLB );
+       public function shutdown( $flags = 0 ) {
+               if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) {
+                       $this->shutdownChronologyProtector( $this->chronProt );
                }
-               foreach ( $this->extLBs as $extLB ) {
-                       $this->chronProt->shutdownLB( $extLB );
-               }
-               $this->chronProt->shutdown();
-               $this->commitMasterChanges();
+               $this->commitMasterChanges( __METHOD__ ); // sanity
        }
 }