Topic on Extension talk:UserMerge

Summary by Ciencia Al Poder
Blakegripling ph (talkcontribs)

OK, let's say that I want to get rid of a swath of spambot accounts from my wiki by using this tool. I can do that one at a time, but the problem is that there are over 9000 junk accounts that I want to get rid of, and yet doing it one per user is way too tedious. Blakegripling ph (talk) 08:12, 30 June 2012 (UTC)

Spellcoder~mediawikiwiki (talkcontribs)

I've too had a need for such a tool, so I've been working on a version of UserMergeAndDelete which can do mass merging to get rid of all the spam accounts on my AmigaCoding wiki. It's still experimental, though it works (just merged 488 accounts with it). It works by entering/copy&pasting a list of usersnames which can be comma-seperated or have each username on a new line (on each line ignore the part after a tab character so I can copy&paste from MySqlAdmin and remove the first columns using blockselection in a texteditor and columns after the username can be ignored). If there's interest in it I might place it only somewhere this month. Spellcoder (talk) 02:19, 14 August 2012 (UTC)

This post was posted by Spellcoder~mediawikiwiki, but signed as Spellcoder.

Blakegripling ph (talkcontribs)

My wiki hasn't been swamped with junk accounts lately, but I might find some use for this, and also in that OSX86 wiki to which I'm an administrator.

Geos one (talkcontribs)

i am interested too plz post thx Mario

Viswaprabha (talkcontribs)

I have a little awkward way to accomplish the bulk merge through a work-around. Hope someone would find it useful! (Must have a little string concatenation skills in spreadsheets; or one may use a python or similar script; or use a text editor with bulk replacement features)

1. Prepare a list of all SPAMuserIDs, store them in a spreadsheet or textfile.

2. The post method used for submitting the Merge & Delete User form (by clicking the button) should be converted to a get method. This will get us a long URL. See the second comment (by Matthew Simoneau) dated 13/Jan/2009) at http://www.mathworks.com/matlabcentral/newsreader/view_thread/242300 for the method.

The resulting URL string should be something like below:

http: //(Your Wiki domain)/Special:UserMerge?olduser=(OldUserNameHere)&newuser=(NewUserNameHere)&deleteuser=1&token=0d30d8b4033a9a523b9574ccf73abad8%2B\

2. Now, divide this URL into four sections:

A: http: //(Your Wiki domain)/Special:UserMerge?olduser=
B: (OldUserNameHere)
C: &newuser=(NewUserNameHere)&deleteuser=1
D: &token=0d30d8b4033a9a523b9574ccf73abad8%2B\


3. Now using a text editor or spreadsheet, prefix each spam userIDs with part A and Suffix each with Part C and D. Part C will include the NewUser(which is a specially created single dummy userID). The Part D, the Token string is a session-dependent token that will be changed per user per session. So you will need to get a new token every time a new session/batch of work is required.

4. With the above step, you should get a long list of URLs, each good to do a Merge&Delete operation for one user. We can now create a simple HTML file, view it and use a batch downloader like DownThemAll in Firefox.

Add two more pieces "<a href=" and "> Linktext</a>" to each line at beginning and end. Also add <html><body> at top and </body></html> at bottom and save the file as (for eg:) userlist.html

5. Open the file in Firefox, use DownThemAll add-on and download all the files! Effectively, you are visiting the Merge&Delete page for each user and clicking the button!

Although this might look a lengthy and tricky job at first, once you follow this method, you can remove tens of thousands of users without much manual efforts.

You can verify if the operation is going well by opening some of the downloaded html files (or by looking through the recent changes in another window). One advantage is that it does not directly edit the MySQL pages. Nor does it require direct database access. List of spam users may be prepared from the user creation logs. If you do have the dB access, the Wiki_user table can be imported into a local list.

Viswaprabha (talk) 20:57, 2 February 2013 (UTC)

Blakegripling ph (talkcontribs)

That method looks crude, but it seems 'swell for admins who are getting jaded at the sheer amount of database-wasting spambot accounts.

Papalotzincoatl (talkcontribs)

Thanks Viswaprabha! Here is below a Python script to concatenate the pieces above and produce the html page to use with DownThemAll! By the way, in my case the URL string that worked uses 'Special:UserMerge&olduser=', with an & in that part instead of the ? in your example.

# Concatenate a list of users to produce URLs which delete them using UserMerge Extension for MediaWiki
# Usage:  python concatenate_UserMerge_MediaWiki.py userslist.txt > userURLlist.html  

import sys

input = open(sys.argv[1])
count = input.readlines()
g = len(count)
input.close()

print "<html><body>"

input = open(sys.argv[1])

for k in range(g):
        line = input.readline()
        print "<a href=\""+"http://(Your Wiki Domain)/index.php?title=Special:UserMerge&olduser="+line+"&newuser=Anonymous&deleteuser=1"+"&token=2c05d520d9b202235c03e8fe8ll8khB\\\""+">User URL Link</a>"

input.close()

print "</html></body>"
Viswaprabha (talkcontribs)

Thank you for that Python script. Never thought my 2 cents would be this useful and appreciable! :)

Uwe a (talkcontribs)

Seems this code stopped working, its not working for me (I get the UserMege special page with emtpy fields) --Uwe a (talk) 22:53, 10 May 2015 (UTC)

Blakegripling ph (talkcontribs)

Yeah the workaround Viswaprabha came up with no longer seems to work. :/