Page MenuHomePhabricator

Create new UserGroupManager::addUserToGroups method
Closed, ResolvedPublic

Description

This ticket is the result of the following comments:

  1. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/702607/5/maintenance/createAndPromote.php#154
  2. 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?

  1. 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 .
  2. Find all uses of the examples above in the other codebases, file a separate ticket for each codebase and create an appropriate patch.

Event Timeline

Change 715273 had a related patch set uploaded (by TChin; author: TChin):

[mediawiki/core@master] Create new UserGroupManager::addUserToGroups method

https://gerrit.wikimedia.org/r/715273

Change 715273 merged by jenkins-bot:

[mediawiki/core@master] Create new UserGroupManager::addUserToMultipleGroups method

https://gerrit.wikimedia.org/r/715273