[MediaWiki-l] Shared user database

James Montalvo jamesmontalvo3 at gmail.com
Fri Dec 11 15:25:01 UTC 2015


My understanding is the best solution is to pick one wiki to have the
`user` table, and have all other wikis point to that one. So if you have
Wiki A and Wiki B with corresponding databases called `wiki_a` and
`wiki_b`, and you want your Wiki A to be your primary wiki, then in your
LocalSettings.php for Wiki B you'd include the following:


// Wiki B is going to share aspects of the Wiki A database
$wgSharedDB = 'wiki_a';

// These are the aspects that will be shared
$wgSharedTables = array(
'user',            // you definitely want to share the table of users
'user_properties', // you also probably want the users' preferences to be
the same across wikis
'interwiki',       // while you're at it, you may also want interwiki
tables to be the same
);


This will work great if you're starting brand new wikis, but since you
already have existing entries for Wiki B you need to merge those into Wiki
A. How you do this depends on your situation. If you only have a small
number of users you may be able to make the changes manually. If you have
all unique usernames then you can possibly use the script I'm working on
[1]. This will only work if your usernames on Wiki A are not on Wiki B, or
if they do exist on both wikis they are guaranteed to represent the same
person. This works, for example in a corporate environment where user
accounts are automatically generated based on the persons corporate
username. This script is very much a work-in-progress, so test it first. I
have not yet used it for my production environment because I got
side-tracked from working on it.

[1] https://gist.github.com/jamesmontalvo3/cb51eb8c6b64a7e58735

--James


On Fri, Dec 11, 2015 at 6:23 AM, Agnese Camellini <
agnese.camellini at gmail.com> wrote:

> I really don't get:
> 1) what you want to do, cause if there are two database it doesn't have any
> sense to make a new one with all the data in the other two, it would be
> better to have the tables shared on both db for the same use in the wiki.
> But i don't have any idea if this can be done in mediawiki,
> 2) As far as i've seen there is an extension to share the users on more
> than one wiki, https://www.mediawiki.org/wiki/Extension:CentralAuth but i
> don't have any idea of how does it work and how can you use it for your
> project so.
>
> Maybe there will be someone more veteran than me that can help you better.
>
>
> On 11 December 2015 at 12:28, Ad Strack van Schijndel <
> ad.strackvanschijndel at gmail.com> wrote:
>
> > Hi,
> >
> > We have one wiki A with thousands of users and one wiki B with a few
> users.
> > We want to have a shared database for the user, preferably the easy way
> as
> > described on https://www.mediawiki.org/wiki/Manual:Shared_database.
> >
> > What would be the appropriate way to go here:
> > - Create a separate database, copy the user table from wiki A to that
> > database, do something with the wiki B users, and configure both wiki's
> to
> > use that shared database.
> > - Use database of wiki A as shared database and explain that to wiki B
> > - Think of something else because it is not possible to have shared
> > database with existing wiki's
> >
> > The first scenario would be the preferred one and I would like to
> > understand if and how that could work.
> >
> > Thanks! Ad
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list