-
Posts
5 -
Joined
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by puzzles
-
-
I solved this issue partially. I created a new value for the connect function to specify which server to connect to. This function works only when a user is logged out (useful for quick loading databases/who's online/rankings). It will not work for logged in characters because their connection is called at /lib/Flux/SessionData.php:355 which applies to all queries. This means when set to a replicated server it breaks gender changes/preferences/slot changes etc. If anyone knows a solution to this issue, please let me know.Replace the connect, getConnection and getStatement functions at lib\Flux\connection.php with these:
private function connect(Flux_Config $dbConfig, $altServer) { $dsn = 'mysql:'; // Differentiate between a socket-type connection or an ip:port // connection. if ($sock=$dbConfig->getSocket()) { $dsn .= "unix_socket=$sock"; } else { if(isset($altServer)) $dsn .= 'host='.Flux::config($altServer.'.Hostname'); else $dsn .= 'host='.$dbConfig->getHostname(); if ($port=$dbConfig->getPort()) { $dsn .= ";port=$port"; } } // May or may not have a database name specified. if ($dbName=$dbConfig->getDatabase()) { if(isset($altServer)) $dsn .= ";dbname=".Flux::config($altServer.'.Database'); else $dsn .= ";dbname=$dbName"; } $persistent = array(PDO::ATTR_PERSISTENT => (bool)$dbConfig->getPersistent()); if(isset($altServer)) return new PDO($dsn, Flux::config($altServer.'.Username'), Flux::config($altServer.'.Password'), $persistent); else return new PDO($dsn, $dbConfig->getUsername(), $dbConfig->getPassword(), $persistent); }
private function getConnection($altServer) { if (!$this->pdoMain) { // Establish connection for main databases. $pdoMain = $this->connect($this->dbConfig, $altServer); $this->pdoMain = $pdoMain; if ($encoding=$this->dbConfig->getEncoding()) { $sth = $this->getStatement("SET NAMES ?"); $sth->execute(array($encoding)); } if ($timezone=$this->dbConfig->getTimezone()) { $sth = $this->getStatement("SET time_zone = ?"); $sth->execute(array($timezone)); } } return $this->pdoMain; }
public function getStatement($statement, $options = array(), $altServer=null) { $dbh = $this->getConnection($altServer); if(isset($options)) $sth = $dbh->prepare($statement, $options); else $sth = $dbh->prepare($statement); @$sth->setFetchMode(PDO::FETCH_CLASS, 'Flux_DataObject', array(null, array('dbconfig' => $this->dbConfig))); if ($sth) { return new Flux_Connection_Statement($sth); } else { return false; } }
Add the following to config\application.php:'MyServer' => array( 'Hostname' => '127.0.0.1', 'Username' => 'username', 'Password' => 'password', 'Database' => 'database' ),
Use this new function for the places you'd like to change servers:getStatement($sql,null,'MyServer');
The item and monster database connections are both made at /lib/Flux/TemporaryTable.php:241 -
For my server setup, I have two SQL databases, one on the athena server and one on the web server. The web server has replication databases of the athena server's databases. I want to have Flux using the web server's replicated databases when querying for data. This is where I have my problem; when a user wants to change account settings like sex, email or password, I want to connect to the main database and not the replicated one. I have narrowed it down and believe Flux CP makes the connection here (in files changepass.php, changesex.php, changemail.php, confirmemail.php):$sth = $server->connection->getStatement($sql);How can I alter this statement in the few locations it will be necessary so it connects to an alternative host address?
-
File Name: Detailed World Map
File Submitter: puzzles
File Submitted: 27 Feb 2012
File Category: Maps & Textures
An alternate world map made to replace the existing client version. This one has the actual map images on it.
Compiled by puzzles.
- 4
Logout and NPC_CALLSLAVE effects both incorrect.
in General Support
Posted · Edited by puzzles
This is the effect the client displays when a monster uses NPC_CALLSLAVE:
Official servers have these effects reversed. The NPC_CALLSLAVE effect currently being used should be used for players logging out and the current logout animation (the same as the one shown when a player or monster teleports) should be used for NPC_CALLSLAVE. Because of this bug, it is not possible to know by the animation whether a player has logged out or has used teleport.
Does anyone know how to fix this issue?
Solved.