This ticket is the result of the following comments:
- https://gerrit.wikimedia.org/r/c/mediawiki/core/+/702607/5/maintenance/createAndPromote.php#154
- https://gerrit.wikimedia.org/r/c/mediawiki/core/+/702607/8/includes/user/UserGroupManager.php#851
Implementation
UserGroupManager::addUserToGroups method should help to avoid such situations --->
foreach ( $promotions as $promotion ) {
$userGroupManager->addUserToGroup( $user, $promotion );
}or
an exapmle
The new method must loop through the list of groups and call UserGroupManager::addUserToGroup every iteration.
How must this ticket be accomplished?
- You need to create the patch for the core in which you add new UserGroupManager::addUserToGroups method, create some test cases for the new method, replace all uses of a loop and UserGroupManager::addUserToGroup with ::addUserToGroups .
- Find all uses of the examples above in the other codebases, file a separate ticket for each codebase and create an appropriate patch.