Copying or merging wiki user accounts

From Biowikifarm Metawiki
Revision as of 11:54, 2 January 2015 by Alvaro Ortiz-Troncoso (Talk | contribs) (1. Backup)

Jump to: navigation, search

There are several use cases where user accounts need to be copied from one wiki to another, e.g.

Merging two wikifarms
Wikifarms store user accounts in the metawiki database, which is shared by all wikis in the wikifarm. If the wikis of a wikifarm (or a selection thereof) need to be moved to another wikifarm, then a merge of the user accounts becomes necessary.
Moving a wikifarm to anothers server
Strictly speaking, moving a wikifarm to another server can be done by copying the whole databse. In practice however, the new wikifarm will often be a separate branch of the original wiki, so a merge becomes necessary.

Overview

The process consists of a sequence of activities, described in more detail below:

  1. Backup the user database
  2. Resolve conflicts
  3. Merge the user accounts
  4. Anonymize user accounts which should be discarded
  5. Clean-up
  • The source database server shall be refered to as "FROM"
  • The sink database server shall be refered to as "TO"

1. Backup

Make a backup of the tables in TO that will be modified:

  • user table in metawiki database
  • user tables user_groups, user_newtalk, user_openid, user_properties, recentchanges, revision, watchlist in all individual wiki databases.

2. Resolve conflicts

User accounts can conflict if the FROM and the TO server have accounts with the same ids but with different data. This can happen if:

  • accounts in the FROM server have been updated after TO was copied.
  • accounts have been created in TO, but not in FROM

Resolving conflicts involves the following actions:

  1. Search for incomplete accounts in FROM (e.g. without an e-mail address). If incomplete accounts are found, stop.
  2. List all conflicting accounts in TO, i.e. which have no equivalent in FROM because they were created after TO was copied.
  3. Add a buffer of e.g. 2000 accounts in TO, to accomodate future account merges.
  4. Move conflicting accounts after the buffer.
  5. Update user ids in the individual wiki databases, in the tables user_groups, user_newtalk, user_openid, user_properties, recentchanges, revision, watchlist.
  6. Check that conflicts are resolved, else stop.