Make ForeignDBRepo::getDBFactory() actually work on 5.3
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Oct 2015 05:36:49 +0000 (22:36 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Oct 2015 07:42:38 +0000 (07:42 +0000)
Change-Id: Id790ccb1728a6a163f2e2149dd56ec1b14fc33af

includes/filerepo/ForeignDBRepo.php

index f3a560b..283576a 100644 (file)
@@ -94,18 +94,19 @@ class ForeignDBRepo extends LocalRepo {
         * @return Closure
         */
        protected function getDBFactory() {
-               return function( $index ) {
-                       return DatabaseBase::factory( $this->dbType,
-                               array(
-                                       'host' => $this->dbServer,
-                                       'user' => $this->dbUser,
-                                       'password' => $this->dbPassword,
-                                       'dbname' => $this->dbName,
-                                       'flags' => $this->dbFlags,
-                                       'tablePrefix' => $this->tablePrefix,
-                                       'foreign' => true,
-                               )
-                       );
+               $type = $this->dbType;
+               $params = array(
+                       'host' => $this->dbServer,
+                       'user' => $this->dbUser,
+                       'password' => $this->dbPassword,
+                       'dbname' => $this->dbName,
+                       'flags' => $this->dbFlags,
+                       'tablePrefix' => $this->tablePrefix,
+                       'foreign' => true,
+               );
+
+               return function ( $index ) use ( $type, $params ) {
+                       return DatabaseBase::factory( $type, $params );
                };
        }