Page MenuHomePhabricator

Update emptyUserGroup.php to optionally support creating log entries for removal
Closed, ResolvedPublic2 Estimated Story Points

Description

Summary

The emptyUserGroup.php script allows emptying of a user group. It does not support creating log entries for these removals, which should be optionally supported.

Background

  • The emptyUserGroup.php maintenance script allows emptying a given user group
  • This script needs to be used on WMF wikis to support T393360: Temporary accounts: Remove users who were autopromoted from the temporary-account-viewer group
    • That ticket specifies that log entries need to be created that explain why the removal occurred
  • The maintenance script currently does not generate any Special:Log entries to indicate the removal
    • The script should optionally support this so that affected users can see why this removal occured

Technical notes

  • We probably want to implement the logging code in EmptyUserGroup because the logging code that exists in SpecialUserRights has extra features we don't need.
  • EmptyUserGroup should then have options to specify if a log entry should be created, along with the performer and comment for that log entry
    • This should also probably be marked as a bot action for recent changes to avoid flooding it

Acceptance criteria

  • Update emptyUserGroup.php to support optionally creating log entries when removing the user groups from users

Event Timeline

Change #1148884 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] [WIP] Support creating logs in emptyUserGroup.php

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

Change #1148884 merged by jenkins-bot:

[mediawiki/core@master] Support creating logs in emptyUserGroup.php

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

Change #1148924 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@wmf/1.45.0-wmf.2] Support creating logs in emptyUserGroup.php

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

Change #1148924 merged by jenkins-bot:

[mediawiki/core@wmf/1.45.0-wmf.2] Support creating logs in emptyUserGroup.php

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

Mentioned in SAL (#wikimedia-operations) [2025-05-21T18:08:30Z] <dreamyjazz@deploy1003> Started scap sync-world: Backport for [[gerrit:1148924|Support creating logs in emptyUserGroup.php (T394914)]]

Mentioned in SAL (#wikimedia-operations) [2025-05-21T18:10:50Z] <dreamyjazz@deploy1003> dreamyjazz: Backport for [[gerrit:1148924|Support creating logs in emptyUserGroup.php (T394914)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-05-21T18:21:48Z] <dreamyjazz@deploy1003> Finished scap sync-world: Backport for [[gerrit:1148924|Support creating logs in emptyUserGroup.php (T394914)]] (duration: 13m 18s)

For QA I would suggest using a local wiki to test:

  1. Creating (or using for the test) several test users, some of which have a specific group assigned
  2. Run emptyUserGroup.php on the specific group defined in step 1 with logging enabled. For example, emptyUserGroup.php --create-log --log-reason "Test"
  3. Verify that the group from step 1 has been emptied
  4. Verify that in the "User rights" log there are log entries to indicate the removal of the group from all the users who had it
Djackson-ctr subscribed.

QA is completed, I have verified the new code changes have been implemented and is functioning as expected (After running maintenance script emptyUserGroup.php, the User Rights Log: will display log entries for each User thats removed from the specified UserGroup that was used with the maintenance script, and the User(s) are removed from the User List of the specified UserGroup).