Search code examples
wikimediawikispamspam-prevention

Mediawiki mass user delete/merge/block


I have 500 or so spambots and about 5 actual registered users on my wiki. I have used nuke to delete their pages but they just keep reposting. I have spambot registration under control using reCaptcha. Now, I just need a way to delete/block/merge about 500 users at once.


Solution

  • You could just delete the accounts from the user table manually, or at least disable their authentication info with a query such as:

    UPDATE /*_*/user SET
      user_password    = '',
      user_newpassword = '',
      user_email       = '',
      user_token       = ''
    WHERE
      /* condition to select the users you want to nuke */
    

    (Replace /*_*/ with your $wgDBprefix, if any. Oh, and do make a backup first.)

    Wiping out the user_password and user_newpassword fields prevents the user from logging in. Also wiping out user_email prevents them from requesting a new password via email, and wiping out user_token drops any active sessions they may have.


    Update: Since I first posted this, I've had further experience of cleaning up large numbers of spam users and content from a MediaWiki installation. I've documented the method I used (which basically involves first deleting the users from the database, then wiping out up all the now-orphaned revisions, and finally running rebuildall.php to fix the link tables) in this answer on Webmasters Stack Exchange.


    Alternatively, you might also find Extension:RegexBlock useful:

    "RegexBlock is an extension that adds special page with the interface for blocking, viewing and unblocking user names and IP addresses using regular expressions."