r41506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41505‎ | r41506 | r41507 >
Date:16:39, 1 October 2008
Author:ialex
Status:old (Comments)
Tags:
Comment:
Allow to specify per connection table prefix
Modified paths:
  • /trunk/phase3/includes/db/LoadBalancer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/LoadBalancer.php
@@ -639,12 +639,17 @@
640640 $dbname = $dbNameOverride;
641641 }
642642
 643+ if( !isset( $prefix ) ){
 644+ global $wgDBprefix;
 645+ $prefix = $wgDBprefix;
 646+ }
 647+
643648 # Get class for this database type
644649 $class = 'Database' . ucfirst( $type );
645650
646651 # Create object
647652 wfDebug( "Connecting to $host $dbname...\n" );
648 - $db = new $class( $host, $user, $password, $dbname, 1, $flags );
 653+ $db = new $class( $host, $user, $password, $dbname, 1, $flags, $prefix );
649654 if ( $db->isOpen() ) {
650655 wfDebug( "Connected\n" );
651656 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r42039Revert r41506 and make LoadBalancer::openForeignConnection() call Database::t...ialex18:38, 13 October 2008

Comments

#Comment by Voice of All (talk | contribs)   19:59, 2 October 2008

This broke my 'centralauth' db. I had to use the 'templateOverridesByServer' to fix it.

#Comment by IAlex (talk | contribs)   16:41, 3 October 2008

I played a bit with that settings, but couldn't reproduce it. Can you provide your settings to see if I can reproduce it?

#Comment by Voice of All (talk | contribs)   00:12, 4 October 2008

Try centralauth/globalblocking with a fake LB factory multi config

#Comment by IAlex (talk | contribs)   09:17, 4 October 2008

I already have CentralAuth and GlobalBlocking with LBFactory_Multi.

#Comment by Tim Starling (talk | contribs)   12:06, 11 October 2008

What's this for? Table prefix is meant to identify the wiki, it's part of the wiki ID. It can't be different between master and slave because replication doesn't work that way.

#Comment by IAlex (talk | contribs)   18:35, 11 October 2008

This allows to have a wiki with a table prefix and an external database (CentralAuth, GlobalBlocking, etc.) with a different prefix or no prefix at all. This is not currently possible because $wgDBprefix will be used for all connections, even if it's one to an external database.

#Comment by Voice of All (talk | contribs)   15:11, 13 October 2008

If not prefix is specified, it will just use the local one, which seems to be the above issue.

#Comment by IAlex (talk | contribs)   18:40, 13 October 2008

I reverted in r42039.

Status & tagging log