I know the WMF did a lot of work recently consolidating user accounts, and I'm wondering if anyone can provide me with some information on how to do it in my much simpler case. We have about 10 wikis setup independently which we'd like to make all use the same user table ($wgSharedDB, $wgSharedTables). Wikis have different sets of users, though many users are active on multiple wikis. A user's ID on one wiki is not likely to be the same on another, but usernames are the same throughout.
Is there an existing project or script that can sort this out? Since a person's username is consistent across wikis it should be something fairly simple like:
1. Read user table for all wikis, create $newUserArray giving each username a new unique ID 2. For each wiki: 1. Loop through the ~17 tables with usernames and user IDs (except the user table) and: 1. For tables with username and id columns: replace the id with the id from $newUserArray 2. For tables with just username (I don't think there are any): No change 3. For tables with just id: Lookup the ID in the user table, use username to get new ID from $newUserArray 2. Update user table IDs (or skip this step in most wikis since we'll only be using one wiki's user table) 3. Create new user table on the one wiki with the shared user table
Does anyone see any issues with this? Any suggestions?
Below is the list of tables I see (for MW 1.23, which we're on currently) that have usernames and/or user IDs. Is there any specific info I need for any of these?
archive: ar_user, ar_user_text external_user: eu_local_id, eu_external_id file_archive: fa_user, fa_user_text image: img_user, img_user_text ipblocks: ipb_user, ipb_by, ipb_by_text logging: log_user, log_user_text old_image: oi_user, oi_user_text page_restrictions: pr_user protected_titles: pt_user recentchanges: rc_user, rc_user_text revision: rev_user, rev_user_text uploadstash: us_user user: user_id, user_name user_former_groups: ufg_user user_groups: ug_user user_newtalk: user_id user_properties: up_user watchlist: wl_user
Thanks, James
See https://www.mediawiki.org/wiki/Extension:CentralAuth
On Wed, Oct 7, 2015 at 8:22 AM, James Montalvo jamesmontalvo3@gmail.com wrote:
I know the WMF did a lot of work recently consolidating user accounts, and I'm wondering if anyone can provide me with some information on how to do it in my much simpler case. We have about 10 wikis setup independently which we'd like to make all use the same user table ($wgSharedDB, $wgSharedTables). Wikis have different sets of users, though many users are active on multiple wikis. A user's ID on one wiki is not likely to be the same on another, but usernames are the same throughout.
Is there an existing project or script that can sort this out? Since a person's username is consistent across wikis it should be something fairly simple like:
- Read user table for all wikis, create $newUserArray giving each username
a new unique ID 2. For each wiki:
- Loop through the ~17 tables with usernames and user IDs (except the
user table) and: 1. For tables with username and id columns: replace the id with the id from $newUserArray 2. For tables with just username (I don't think there are any): No change 3. For tables with just id: Lookup the ID in the user table, use username to get new ID from $newUserArray 2. Update user table IDs (or skip this step in most wikis since we'll only be using one wiki's user table) 3. Create new user table on the one wiki with the shared user table
Does anyone see any issues with this? Any suggestions?
Below is the list of tables I see (for MW 1.23, which we're on currently) that have usernames and/or user IDs. Is there any specific info I need for any of these?
archive: ar_user, ar_user_text external_user: eu_local_id, eu_external_id file_archive: fa_user, fa_user_text image: img_user, img_user_text ipblocks: ipb_user, ipb_by, ipb_by_text logging: log_user, log_user_text old_image: oi_user, oi_user_text page_restrictions: pr_user protected_titles: pt_user recentchanges: rc_user, rc_user_text revision: rev_user, rev_user_text uploadstash: us_user user: user_id, user_name user_former_groups: ufg_user user_groups: ug_user user_newtalk: user_id user_properties: up_user watchlist: wl_user
Thanks, James _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I think your plan sounds basically sane. I don't think there's anything that would do the work for you, but you might want to look at the source code of https://www.mediawiki.org/wiki/Extension:UserMerge to confirm your list of tables that store user ids and will need updates.
Note that various extensions also have their own tables and also store user ids, the UserMerge extension has some hooks to make it possible to update their data.
wikitech-l@lists.wikimedia.org