rdbms: Rename "memCache" to "memStash" in LBFactory
[lhc/web/wiklou.git] / includes / libs / rdbms / lbfactory / LBFactory.php
index f05dabc..c891fb6 100644 (file)
@@ -30,9 +30,6 @@ use EmptyBagOStuff;
 use WANObjectCache;
 use Exception;
 use RuntimeException;
-use IDatabase;
-use DBTransactionError;
-use DBReplicationWaitError;
 
 /**
  * An interface for generating database load balancers
@@ -58,7 +55,7 @@ abstract class LBFactory implements ILBFactory {
        /** @var BagOStuff */
        protected $srvCache;
        /** @var BagOStuff */
-       protected $memCache;
+       protected $memStash;
        /** @var WANObjectCache */
        protected $wanCache;
 
@@ -96,7 +93,7 @@ abstract class LBFactory implements ILBFactory {
                }
 
                $this->srvCache = isset( $conf['srvCache'] ) ? $conf['srvCache'] : new EmptyBagOStuff();
-               $this->memCache = isset( $conf['memCache'] ) ? $conf['memCache'] : new EmptyBagOStuff();
+               $this->memStash = isset( $conf['memStash'] ) ? $conf['memStash'] : new EmptyBagOStuff();
                $this->wanCache = isset( $conf['wanCache'] )
                        ? $conf['wanCache']
                        : WANObjectCache::newEmpty();
@@ -253,6 +250,10 @@ abstract class LBFactory implements ILBFactory {
                } );
        }
 
+       public function hasTransactionRound() {
+               return ( $this->trxRoundId !== false );
+       }
+
        /**
         * Log query info if multi DB transactions are going to be committed now
         */
@@ -434,7 +435,7 @@ abstract class LBFactory implements ILBFactory {
                }
 
                $this->chronProt = new ChronologyProtector(
-                       $this->memCache,
+                       $this->memStash,
                        [
                                'ip' => $this->requestInfo['IPAddress'],
                                'agent' => $this->requestInfo['UserAgent'],
@@ -508,7 +509,8 @@ abstract class LBFactory implements ILBFactory {
                        'errorLogger' => $this->errorLogger,
                        'hostname' => $this->hostname,
                        'cliMode' => $this->cliMode,
-                       'agent' => $this->agent
+                       'agent' => $this->agent,
+                       'chronologyProtector' => $this->getChronologyProtector()
                ];
        }
 
@@ -528,7 +530,7 @@ abstract class LBFactory implements ILBFactory {
                        $prefix
                );
 
-               $this->forEachLB( function( ILoadBalancer $lb ) use ( $prefix ) {
+               $this->forEachLB( function ( ILoadBalancer $lb ) use ( $prefix ) {
                        $lb->setDomainPrefix( $prefix );
                } );
        }
@@ -579,3 +581,5 @@ abstract class LBFactory implements ILBFactory {
                $this->destroy();
        }
 }
+
+class_alias( LBFactory::class, 'LBFactory' );