User:FireDragon~metawiki/Bug2396

http://bugzilla.wikimedia.org/show_bug.cgi?id=2396 edit

Summary: How to use realy multiple mediaWiki's with tabel-database-prefix and $wgSharedDB setting

Keywords: patch need-review, testme

Meta: unified user database, prefix, multi mediawiki, $wgSharedDB, Database.php


I have change the file '\includes\Database.php' at line 1003 to 1019

My new code is:

function tableName( $name ) {
   global $wgSharedDB;
   # Skip quoted literals
   if ( $name{0} != '`' ) {
      if ( isset( $wgSharedDB ) && 'user' == $name ) {
         $name = $wgSharedDB . $name;
      } else {
         if ( $this->mTablePrefix !==  &&  strpos( '.', $name ) === false ) {
            $name = "{$this->mTablePrefix}$name";
         } else {
            # Standard quoting
            $name = "`$name`";
         }
      }
   }
   return $name;
}

I have change the 'IF'- enquiry position and add a 'ELSE'.

A example: I have install 2 wikis (local) with the prefix 'en_' and 'de_'

Then I change the 'Database.php' with my code.

In the 'LocalSettings.php' have change to:

Sample code for the english mediawiki folder !

$wgDBprefix         = "en_";
$wgSharedDB         = "de_";

So you can now use many other mediawiki's folder with other language

And the user must now! only one to register for all mediawiki's on the same server withe the same database name.

I test it now on my webserver in the next time at http://www.wikipage.de

I use not the official mediawiki- software! I use the 'MediaWiki 1.5alpha1 +ENotif/EConfirm v3.27 +AutoLogin v1.1' from http://meta.wikimedia.org/wiki/Email_notification_%28documentation%29#Download

Thats a very cool and good Extensions !!!