SUL finalisation/Global account merge

dumped from etherpad

Related bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=47918

This Etherpad will be used to document the requirements of the GlobalAccountMerge tool. This tool is designed to perform cleanup after the SUL finalisation. Example:

Before finalisation: Person A owns the Philippe global account. Person B owns the Philippe local accounts on both frwiki and dewiki, where they have made a nonzero number of edits.

The finalisation: Since person A owns the global account, they win the name. Two new global accounts are created, namely Philippe@frwiki and Philippe@dewiki, and the local accounts that have the edits on frwiki and dewiki are moved into the respective global accounts.

Post finalisation: Person B now owns two global accounts, Philippe@frwiki (which has his old account from frwiki on it) and Philippe@dewiki (which has his old account from dewiki on it). They want these two global accounts to be merged into a single global account.

Requirements:

  1. The tool takes the name of a master global account which the other accounts will be merged in to.
  2. The tool takes one or more other child global accounts, which will have their local accounts merged into the master account.
  3. The tool then, for each wiki, merges all of the local accounts on that wiki for the child accounts into the master local account.
  4. After step 3 is done, all of the child global accounts will have no local accounts attached to them anymore, as they've been merged in to the parent The tool then deletes all of the child global accounts.

pseudocode for step 3 to make it clearer what I mean:

lock all parent and child accounts so the user can't login and mess stuff up
for (each wiki)

    create (and attach) the parent local account, if not created alredy

    for (each child global account)

        merge child local account on this wiki into parent local account on this wiki

    end

end
for (each child global account)

    if (child global account has no local accounts attached to it any more)

        delete child global account

    end

end
unlock the parent account
return