Merge "Html: Update list of $voidElements"
[lhc/web/wiklou.git] / includes / filerepo / ForeignDBViaLBRepo.php
index a002aad..55df1af 100644 (file)
  * @ingroup FileRepo
  */
 class ForeignDBViaLBRepo extends LocalRepo {
-       var $wiki, $dbName, $tablePrefix;
-       var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
-       var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
+       /** @var string */
+       protected $wiki;
+
+       /** @var string */
+       protected $dbName;
+
+       /** @var string */
+       protected $tablePrefix;
+
+       /** @var array */
+       protected $fileFactory = [ 'ForeignDBFile', 'newFromTitle' ];
+
+       /** @var array */
+       protected $fileFromRowFactory = [ 'ForeignDBFile', 'newFromRow' ];
+
+       /** @var bool */
+       protected $hasSharedCache;
 
        /**
-        * @param $info array|null
+        * @param array|null $info
         */
        function __construct( $info ) {
                parent::__construct( $info );
@@ -42,17 +56,27 @@ class ForeignDBViaLBRepo extends LocalRepo {
        }
 
        /**
-        * @return DatabaseBase
+        * @return IDatabase
         */
        function getMasterDB() {
-               return wfGetDB( DB_MASTER, array(), $this->wiki );
+               return wfGetDB( DB_MASTER, [], $this->wiki );
        }
 
        /**
-        * @return DatabaseBase
+        * @return IDatabase
         */
        function getSlaveDB() {
-               return wfGetDB( DB_SLAVE, array(), $this->wiki );
+               return wfGetDB( DB_REPLICA, [], $this->wiki );
+       }
+
+       /**
+        * @return Closure
+        */
+       protected function getDBFactory() {
+               $wiki = $this->wiki;
+               return function( $index ) use ( $wiki ) {
+                       return wfGetDB( $index, [], $wiki );
+               };
        }
 
        function hasSharedCache() {
@@ -79,4 +103,8 @@ class ForeignDBViaLBRepo extends LocalRepo {
        protected function assertWritableRepo() {
                throw new MWException( get_class( $this ) . ': write operations are not supported.' );
        }
+
+       public function getInfo() {
+               return FileRepo::getInfo();
+       }
 }