Merge "rdbms: Disable DBConnRef::selectDB() for sanity"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DBConnRef.php
index dedf6ea..eba1657 100644 (file)
@@ -46,7 +46,7 @@ class DBConnRef implements IDatabase {
                        $this->conn = $this->lb->getConnection( $db, $groups, $wiki, $flags );
                }
 
-               return call_user_func_array( [ $this->conn, $name ], $arguments );
+               return $this->conn->$name( ...$arguments );
        }
 
        public function getServerInfo() {
@@ -167,6 +167,9 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       /**
+        * @codeCoverageIgnore
+        */
        public function getWikiID() {
                return $this->getDomainID();
        }
@@ -284,6 +287,12 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
+       public function lockForUpdate(
+               $table, $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
+       ) {
+               return $this->__call( __FUNCTION__, func_get_args() );
+       }
+
        public function fieldExists( $table, $field, $fname = __METHOD__ ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
@@ -362,7 +371,8 @@ class DBConnRef implements IDatabase {
        }
 
        public function selectDB( $db ) {
-               return $this->__call( __FUNCTION__, func_get_args() );
+               // Disallow things that might confuse the LoadBalancer tracking
+               throw new DBUnexpectedError( $this, "Database selection is disallowed to enable reuse." );
        }
 
        public function getDBname() {