lb = $lb; if ( $conn instanceof DatabaseBase ) { $this->conn = $conn; } else { $this->params = $conn; } } public function __call( $name, $arguments ) { if ( $this->conn === null ) { list( $db, $groups, $wiki ) = $this->params; $this->conn = $this->lb->getConnection( $db, $groups, $wiki ); } return call_user_func_array( array( $this->conn, $name ), $arguments ); } public function __destruct() { if ( $this->conn !== null ) { $this->lb->reuseConnection( $this->conn ); } } }