https://bugzilla.wikimedia.org/show_bug.cgi?id=33767
Pavel Malakhov <pavelmala...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |crosswiki Status|RESOLVED |REOPENED Resolution|WONTFIX | --- Comment #11 from Pavel Malakhov <pavelmala...@gmail.com> 2012-01-24 22:57:28 UTC --- Excuse me for annoying you. But this is not a bug report, but a feature request for wfGetDB(). So it is fair to close it (as I understand) in one of the following cases: 1. the feature is implemented 2. there is another way to perform the same task (and the existed way is simple and comfortable just the same) 3. there is no way to implement the requested feature None of above is achieved yet, so forgive me for reopening the request. It is still urgent. 1) As to item "1": your suggestions and links helped me to understand (by investigating the code) that wfGetDB() is binded to LoadBalancer. Using LoadBalancer for connection to foreign databases is a) rather complex b) most likely lead to errors when connect to wiki, which uses LoadBalancer (with several servers) itself 2) We can use class DatabaseMysql: $db = new DatabaseMysql(); if ( $db->Open($wiki->db['server'], $wiki->db['user'], $wiki->db['password'], $wiki->db['name']) ) {... But when try to work with DB I stumble upon the automated 'correction' of DatabaseBase::tableName() which "adds a table prefix if only given a table name with no quotes". In real life that means that the code $lastmod = $db->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ ); becomes incorrect for any DB where table prefix is different from local wiki tables. The code should be modified to: $table_recentchanges = '`'. $wiki->prefix .'recentchanges`'; $lastmod = $db->selectField( $table_recentchanges, 'MAX(rc_timestamp)', false, __METHOD__ ); That turns the code to rather complecated one when you start to build SQL statements (and I could not make it work in some cases yet) 3) As to first item: the optional parameter "server" could be added to wfGetDB() and treated by MediaWiki engine with or without LoadBalancer by checking if it (the server) exists in the LoadBalancer servers array. Or/And As to second item: the option "tablePrefix" could be added to DatabaseBase::Open and to constructor of DatabaseMysql (particularly) class -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l