Jump to content

Extension talk:UserMerge/Archive 2

About this board

It is preferred that you open a regular bug report under the MediaWiki-extensions-UserMerge product for new issues.


Error When Attempting to Merge Users

4
Summary by Network-charles

I downloaded v1.41 of the extension directly and it worked. Initially, I installed the UserMerge extension using Git. You can find the phabricator link here.

Network-charles (talkcontribs)

On my MediaWiki software, I keep getting the below error whenever I attempt to merge users:

/mediawiki-1.41.0/index.php/Special:UserMerge Error: Call to undefined method MediaWiki\MediaWikiServices::getConnectionProvider()

Backtrace:

from /var/www/html/mediawiki-1.41.0/extensions/UserMerge/includes/MergeUser.php(79)

# 0 /var/www/html/mediawiki-1.41.0/extensions/UserMerge/includes/MergeUser.php(55): MergeUser->mergeEditcount()
# 1 /var/www/html/mediawiki-1.41.0/extensions/UserMerge/includes/SpecialUserMerge.php(141): MergeUser->merge()
# 2 /var/www/html/mediawiki-1.41.0/includes/htmlform/HTMLForm.php(751): SpecialUserMerge->onSubmit()
# 3 /var/www/html/mediawiki-1.41.0/includes/htmlform/HTMLForm.php(631): HTMLForm->trySubmit()
# 4 /var/www/html/mediawiki-1.41.0/includes/htmlform/HTMLForm.php(647): HTMLForm->tryAuthorizedSubmit()
# 5 /var/www/html/mediawiki-1.41.0/includes/specialpage/FormSpecialPage.php(231): HTMLForm->show()
# 6 /var/www/html/mediawiki-1.41.0/includes/specialpage/SpecialPage.php(727): MediaWiki\SpecialPage\FormSpecialPage->execute()
# 7 /var/www/html/mediawiki-1.41.0/includes/specialpage/SpecialPageFactory.php(1621): MediaWiki\SpecialPage\SpecialPage->run()
# 8 /var/www/html/mediawiki-1.41.0/includes/MediaWiki.php(357): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
# 9 /var/www/html/mediawiki-1.41.0/includes/MediaWiki.php(960): MediaWiki->performRequest()
# 10 /var/www/html/mediawiki-1.41.0/includes/MediaWiki.php(613): MediaWiki->main()
# 11 /var/www/html/mediawiki-1.41.0/index.php(50): MediaWiki->run()
# 12 /var/www/html/mediawiki-1.41.0/index.php(46): wfIndexMain()
# 13 {main}
Network-charles (talkcontribs)

Hi @Pppery, have you encountered this error before? I was experimenting with a concept while trying to update the Help:Renaming users page. Although I ultimately went with a different example, I'd appreciate your help in resolving this issue.

Pppery (talkcontribs)

No, I've never seen this error before. But I don't actively use UserMerge either, and it's not been as actively maintained as it should be for years, so I would not be surprised if this is a real bug that needs to be reported on Phabricator.

Network-charles (talkcontribs)

Okay, I will report it.

AlPaD (talkcontribs)

Hello! Could you tell me "$wgGroupPermissions['bureaucrat']['usermerge'] = true;" which folder and where in the folder should I put it? Thanks!

Ciencia Al Poder (talkcontribs)
Reply to "Help to install"

References from Version History not converted

1
NoHTTP (talkcontribs)

Tried this Plugin on a user A and B in mediawiki 1.37.4

It said that the users A was merged successfully to B, but in the history of a random-picked sample page the edits still were listed as user A.

I repeated the drill and selected "Delete old user". After that the edit-logs of user "A" were all gone. The edit history had only records for other users.

My expectation would be, that edits from user "A" are beeing listed as from user "B" after the merge.

Reply to "References from Version History not converted"
Summary by Seb35

False alert: someone flagged this extension as incompatible with 1.38, but either it was a small issue either it is solved since 3 July: it works with 1.38 and current master (1.39.0-alpha).

105.105.142.182 (talkcontribs)

What happens if you install this extension on MediaWiki 1.38 or 1.39?

FreedomFighterSparrow (talkcontribs)

I'm not sure if it doesn't work - an anon IP added the original note about MW 1.38 incompatibility, and I don't see any open issues regarding it.

105.105.76.253 (talkcontribs)

Should I consider this extension unmaintained?

FreedomFighterSparrow (talkcontribs)

It looks like it received updates as late as Jun 19th, and it's in use by some prominent releases, such as BlueSpice. I'm not sure if there's an official active maintainer.

I think you should just try it on a later version.

Seb35 (talkcontribs)

I and Kghbln reverted the warning given I just tested with MW 1.38 and 1.39 and it works. Perhaps phabricator:T281821 was an issue a few months ago, but it is solved.

If you have specific issues with the extension, please open a task on Phabricator and describe the issue. Be sure you use the lastest version of the extension in the branch REL1_38 (Git method), or you recently downloaded the latest version (branch 1.38) of the extension on Special:ExtensionDistributor/UserMerge.

HackForLive (talkcontribs)

I would like to contribute with multiple user merge scripts. The motivation behind this approach is to merge a list of users without manually entering each user on Special:UserMerge page.

I spin up mediawiki using vagrant. It was running on localhost with administrator credentials (admin:vagrant). I created manually Testold, Testnew and Testold2,Testnew2 users. As a result Testold user should be merged to Testnew and Testold2 shoudl be merged to Testnew2.

Following steps are implemented in provided scripts:

  1. Retrieve login token via mediawiki API
  2. Logon as admin (or someone with usermerge privileges) using login token
  3. Retrieve csfr token via mediawiki API
  4. Loop over users to be merged and for each send post request using csfr token

Tested on Mediawiki version 1.31.x and 1.39.x ‎

Powershell:

$baseUrl = 'http://localhost:8080'
$resp = invoke-webrequest -method GET -uri "
${baseUrl}/w/api.php?action=query&meta=tokens&format=json&type=login" -ContentType "application/json" -SessionVariable session
$loginToken = ($resp.Content | ConvertFrom-Json).query.tokens.logintoken

$body = @{
   "action" = "clientlogin"
   "logintoken" = "${loginToken}"
   "username" = "admin"
   "password" = "vagrant"
}

$resp = Invoke-WebRequest -Method POST -Uri "${baseUrl}/w/api.php?action=clientlogin&loginreturnurl=${baseUrl}/&format=json" -Body $body -WebSession $session
Write-Host ($resp.Content)

$resp = invoke-webrequest -method GET -uri "${baseUrl}/w/api.php?action=query&meta=tokens&format=json" -ContentType "application/json" -WebSession $session
$csfrToken = ($resp.Content | ConvertFrom-Json).query.tokens.csrftoken

$users = @(
    @{
        olduser = 'Testold'
        newuser = 'Testnew'
        # Testold will not be deleted
		deleteOldUser = 0
    },
    @{
        olduser = 'Testold2'
        newuser = 'Testnew2'
		# Testold2 will be deleted
        deleteOldUser = 1
    }
)

foreach($user in $users){
    $body = @{
        wpolduser=$user['olduser']
        wpnewuser=$user['newuser']
        wpdelete=$user['deleteOldUser']
        wpEditToken=$csfrToken
        title='Special:UserMerge'
        redirectparams=
    }

    $resp = invoke-webrequest -method Post -uri "${baseUrl}/wiki/Special:UserMerge" -Body $body -WebSession $session
    Write-Host ($resp.ParsedHtml.getElementsByTagName('p') | select -Property innerHtml)
}

Python:

#!/usr/bin/python3

"""
    clientlogin.py

    MediaWiki UserMerge Code Sample
"""

import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup

def client_login(url, login_token, username, password):
    """ Send a post request along with login token, user information
    and return URL to the API to log in on a wiki """

    response = S.post(url=urljoin(url, 'w/api.php'), data={
        'action': "clientlogin",
        'username': username,
        'password': password,
        'loginreturnurl': url,
        'logintoken': login_token,
        'format': "json"
    })

    return response.json()

def fetch_login_token(url):
    """ Fetch login token via `tokens` module """

    response = S.get(
        url=urljoin(url, 'w/api.php'),
        params={
            'action': "query",
            'meta': "tokens",
            'type': "login",
            'format': "json"})
    data = response.json()
    return data['query']['tokens']['logintoken']

def fetch_csfr_token(url):
    """ Fetch csfr token via `tokens` module """

    response = S.get(
        url=urljoin(url, 'w/api.php'),
        params={
            'action': "query",
            'meta': "tokens",
            'format': "json"})
    data = response.json()
    return data['query']['tokens']['csrftoken']

def user_merge(url, users, csfr_token):
    """ User merge action """
    for user in users:
        response = S.post(
            url=urljoin(url, 'wiki/Special:UserMerge'),
            data={
                "wpolduser": user["oldUser"],
                "wpnewuser": user["newUser"],
                "wpdelete": user["deleteOldUser"],
                "wpEditToken": csfr_token,
                "title": "Special:UserMerge",
                "redirectparams": ""
            }
        )
        soup = BeautifulSoup(response.text, 'lxml')
        print(soup.find_all('p'))
    pass

if __name__ == "__main__":
    S = requests.Session()
    URL = "http://localhost:8080"
    
    login_token = fetch_login_token(URL)
    print(client_login(URL, login_token, 'admin', 'vagrant'))
    
    csfr_token = fetch_csfr_token(URL)
    print(csfr_token)
    users = [{'oldUser':'Testold', 'newUser':'Testnew', 'deleteOldUser': 0},
             {'oldUser':'Testold2', 'newUser':'Testnew2', 'deleteOldUser': 1}]
    user_merge(URL, users, csfr_token)
Reply to "User mass merge"

UserMerge CannotCreateActorException

2
Summary by Kghbln

See also the respective mailing list thread

Silkwood (talkcontribs)

My config:

Product Version
MediaWiki 1.33.1 (d35fba2)

15:11, December 17, 2019

PHP 7.2.17-0ubuntu0.18.04.1 (apache2handler)
MariaDB 10.1.38-MariaDB-0ubuntu0.18.04.1
UserMerge 1.10.1 (4b7feed) 08:17, July 24, 2019


trying to delete a user (merging it to Anonymous) I get this error and the following backtrace:

UserMerge CannotCreateActorException from line 2516 of /var/www/w/includes/user/User.php: Cannot create an actor for a usable name that is not an existing user.

Backtrace:

#0 /var/www/w/extensions/UserMerge/includes/MergeUser.php(378): User->getActorId(Wikimedia\Rdbms\DatabaseMysqli)

#1 /var/www/w/extensions/UserMerge/includes/MergeUser.php(50): MergeUser->mergeDatabaseTables(string)

#2 /var/www/w/extensions/UserMerge/includes/SpecialUserMerge.php(135): MergeUser->merge(User, string)

#3 /var/www/w/includes/htmlform/HTMLForm.php(660): SpecialUserMerge->onSubmit(array, OOUIHTMLForm)

#4 /var/www/w/includes/htmlform/HTMLForm.php(552): HTMLForm->trySubmit()

#5 /var/www/w/includes/htmlform/HTMLForm.php(567): HTMLForm->tryAuthorizedSubmit()

#6 /var/www/w/includes/specialpage/FormSpecialPage.php(184): HTMLForm->show()

#7 /var/www/w/includes/specialpage/SpecialPage.php(569): FormSpecialPage->execute(NULL)

#8 /var/www/w/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)

#9 /var/www/w/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)

#10 /var/www/w/includes/MediaWiki.php(865): MediaWiki->performRequest()

#11 /var/www/w/includes/MediaWiki.php(515): MediaWiki->main()

#12 /var/www/w/index.php(42): MediaWiki->run()

#13 {main}

Silkwood (talkcontribs)

Solved!

It was enough to add the following line in LocalSettings.php


// Add just one user name to the default array

$wgReservedUsernames[] = 'Anonymous';


to get this:


Merge from Giada (691) to Anonymous (0) is complete.

Giada (691) has been deleted.


Thanks to Brian Wolff


Merging IP contributions to an user

2
Tinker Bell (talkcontribs)

Well, that. It's possible to merge the contributions of an IP to an existing account?

Crochet.david (talkcontribs)

no, an IP contribution can be by anybody, even if your have an IPV6 or a static IPv4.

Reply to "Merging IP contributions to an user"

Could this work with version 1.25?

3
Bmrberlin (talkcontribs)
Zer00CooL (talkcontribs)

I have test UserMerge and work fine with mediawiki 1.32.0

Bmrberlin (talkcontribs)

Thank you, but I asked for version 1.25.@Bmrberlin

Reply to "Could this work with version 1.25?"

How i can purge the content from Spécial:Journal/usermerge

5
Zer00CooL (talkcontribs)

I would not want to display the actions performed.

- Either hide them from the public

- Or, preferably, be able to delete them by myself.

How to do ?

Can I empty such information from the database?

Where are the information stored?


The Merge and Delete User information is always displayed from Spécial:Journal/usermerge

The same from Spécial:Modifications_récentes

Ciencia Al Poder (talkcontribs)

You can suppress the contents of those logs (the log will be there, but the information not visible to others) if you have the deletelogentry permission (see Manual:User_rights#List_of_permissions)

Ciencia Al Poder (talkcontribs)

A better approach is to add that log to Manual:$wgFilterLogTypes, which would hide them from Special:RecentChanges and Special:Log (unless specifically requested to be shown).

If you don't want them to be visible even when explicitly requested, add it to Manual:$wgLogRestrictions.

Zer00CooL (talkcontribs)

I do not know either of them. I watch.

We do not hesitate to complete here a little information.

To be able to manage the deletion, or, to hide the logs totally, would be a plus for this UserMerge extension.

Thank you for participating in the discussion so quickly.


I had already tested Logrestriction but I was not able to get what I wanted, to properly hide UserMerge logs, to non-connected users and to single users.


Test 1 # KO

An intermediate solution would be to disable the extension once the merges and deletions have been made.

If the extension is disabled, "log-name-usermerge" is displayed instead of "User Account Merge Log".

A single line will then be displayed in the last changes since Mediawiki: "18:25 (⧼log-name-usermerge⧽). [Zer00CooL (46 ×)]"

Even so, the pages I post on another site with an RSS feed continue to serve the information, a line for each profile that has been merge and deleted.

Disabling the extension is therefore useless. I leave the extension enabled.


Test 2 # KO

# Do not display the UserMerge logs.

$ wgLogRestrictions = ['usermerge' => 'bureaucrat'];

# Bug 1

# Works in part since Special: Journal

The logs are not displayed.

The logs are not displayed either with my connected bureaucrat user.

# Bug 2

# Error from Special page: Journal / usermerge

You can not ⧼action-bureaucrat⧽, for the following reason:

You do not have sufficient rights to perform the requested action.


Test 3 # KO

Another alternative would be to use Lockdown but still it does not seem to work.

I am not on options to indicate, I try "usermerge" to forbid to "user" but the users always have access to the information of journaling, in particular, on "Latest modifications".

I found how to hide all the "last changes" but this is not the purpose of hiding all the changes, only the merge and deletion of user account.


###

I may not use the right configurations, I do not know how to move on now.

###


# TODO

I would then search the database for "deleted the user account" or "log-name-usermerge" or "usermerge".

See if it is possible to delete these kind of entries directly from the database.

# I think it would have been better to use the CleanMediawiki.sh script to delete users. I did not test it. https://github.com/ZerooCool/cleanmediawiki


My research in French on UserMerge :

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki#Merger_ou_supprimer_un_utilisateur_avec_l.27extension_UserMerge

Zer00CooL (talkcontribs)

OK with this adds to the LocalSettings.php

$wgGroupPermissions['sysop']['deletelogentry'] = true;

$wgGroupPermissions['sysop']['deleterevision'] = true;


https://wiki.visionduweb.fr/index.php?title=Sp%C3%A9cial:Journal/usermerge

The RevisionDelete extension allowed me to replace the UserMerge logging information with neutral information. I would have preferred to delete UserMerge's logging information but the RevisionDelete extension still looks interesting. The history is preserved. The irrelevant information is neutralized.

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki#Restreindre_la_consultation_des_r.C3.A9visions


I guess I can rely on the CleanMediawiki.sh script to learn more about how to clean mediawiki by going through this script.

Nevertheless, the issue remains open if anyone can explain to me with an example adapted to UserMerge, how to delete ALL the logging data of UserMerge.

Reply to "How i can purge the content from Spécial:Journal/usermerge"

How do you actually delete users

4
Jamiehutber (talkcontribs)

I have tried and tried using:

`%login%, AAHWayne00562260`

or

`AAHWayne00562260`


But both result in the same error as seen in the error

My problem is that I have some 27k fake user accounts, so I opted for the comma seperated, this doens't appear to work.


So how can I delete all 27k banned users?

Zer00CooL (talkcontribs)

Add a captchap to slow down spam

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki


You can read this to clean mediawiki spam

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki#Nettoyer_les_spams_sur_mediawiki


Look to delete inactif user too

Manual:RemoveUnusedAccounts.php


You can look this

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki#Cleanmediawiki

and

https://wiki.visionduweb.fr/index.php?title=Maintenance_et_securite_de_Mediawiki#Clean_up_MediaWiki_after_a_spammer

Zer00CooL (talkcontribs)

You can test, and, confirm, the best is Cleanmediawiki ut, it's not a officiel repo. Why ? I don't know.

Zer00CooL (talkcontribs)

I have test UserMerge and work fine with mediawiki 1.32.0


I can only delete one user at a time, return to the merge form to delete a second user, return to the form, and so on ...

It's a good tool, but slow, if you have multiple users to delete.

Reply to "How do you actually delete users"