* @param array $add Array of groups to add
* @param array $remove Array of groups to remove
* @param string $reason Reason for group change
+ * @param array $tags Array of change tags to add to the log entry
* @return array Tuple of added, then removed groups
*/
- function doSaveUserGroups( $user, $add, $remove, $reason = '' ) {
+ function doSaveUserGroups( $user, $add, $remove, $reason = '', $tags = [] ) {
// Validate input set...
$isself = $user->getName() == $this->getUser()->getName();
$groups = $user->getGroups();
$groups )
);
+ Hooks::run( 'ChangeUserGroups', [ $this->getUser(), $user, &$add, &$remove ] );
+
$oldGroups = $user->getGroups();
$newGroups = $oldGroups;
Hooks::run( 'UserRights', [ &$user, $add, $remove ], '1.26' );
if ( $newGroups != $oldGroups ) {
- $this->addLogEntry( $user, $oldGroups, $newGroups, $reason );
+ $this->addLogEntry( $user, $oldGroups, $newGroups, $reason, $tags );
}
return [ $add, $remove ];
* @param array $oldGroups
* @param array $newGroups
* @param array $reason
+ * @param array $tags
*/
- function addLogEntry( $user, $oldGroups, $newGroups, $reason ) {
+ function addLogEntry( $user, $oldGroups, $newGroups, $reason, $tags ) {
$logEntry = new ManualLogEntry( 'rights', 'rights' );
$logEntry->setPerformer( $this->getUser() );
$logEntry->setTarget( $user->getUserPage() );
'5::newgroups' => $newGroups,
] );
$logid = $logEntry->insert();
+ if ( count( $tags ) ) {
+ $logEntry->setTags( $tags );
+ }
$logEntry->publish( $logid );
}
return 'users';
}
}
-