Page MenuHomePhabricator

[Edit Counter] Show time of autoconfirmed promotion in user rights log
Closed, ResolvedPublic

Description

Motivation:
Someone in our community is discussing a problem that how do we get the time of a user become an autoconfirmed user. Now people can only know if this user belongs to the autoconfirmed user group.

Can we add this feature? You can refer my rough code.

XTools version: 3.1.45-1ad850c

Event Timeline

The main issue is that not every wiki has the same definition for autoconfirmed. On enwiki, it's 10 edits over 4 days, but on some other wikis becoming autoconfirmed is only a matter of time, and has nothing to do with the number of edits. I don't know how we could query for this information programmatically.

Looks like no API can do it. However we can get definition for autoconfirmed from InitialiseSettings.php.

Ooooof, this is beginning to look like another per-wiki configuration setting, which is what we're trying to avoid. XTools has no visibility to InitializeSettings.php, so it would need to be something that we could see in the database.

I'm also not seeing any way to see the changes in the user rights log on https://www.mediawiki.org/wiki/Manual:Autoconfirmed_users - though I could be wrong.

so it would need to be something that we could see in the database

It looks like an autoconfirmed right is not stored in the database, but is dynamically calculated at runtime.

XTools has no visibility to InitializeSettings.php

We can get contents of this file from git and then process the file.

XTools has no visibility to InitializeSettings.php

We can get contents of this file from git and then process the file.

Now that's a thought. Both of our hosts do have Git on them, so it is theoretically possible.

We'll look into it some more and get back to you.

You can also parse https://noc.wikimedia.org/conf/highlight.php?file=InitialiseSettings.php, that corresponds to the last up-to-date prod version.

I don't think this looks too bad, actually! Yes going off of noc.wikimedia.org is the right way, thank you Framawiki.

Something like https://regex101.com/r/mUW2om/1

This may mean we have to use eval (bad), but with that regex it's only capturing the spaces, multiplication sings, and digits. Not that Wikimedia would put any malicious code in there =P In addition, the result should be casted as an integer, wrapped in a try/catch block in case something goes wrong, and cached.

We can have "+autoconfirmed" show up as an "Automatic" promotion in the existing Rights Changes section of the Edit Counter.

Using regular expressions to capture the configuration can be a bit complicated. In contrast, it is easier to explain them as PHP code. We can directly load (require_once) this file. But this method is error-prone and unstable.

Using regular expressions to capture the configuration can be a bit complicated. In contrast, it is easier to explain them as PHP code. We can directly load (require_once) this file. But this method is error-prone and unstable.

I am very against this approach, it opens us up to arbitrary script execution.

Another way is to develop an mediawiki-core API that can access definition for autoconfirmed.

MusikAnimal renamed this task from [Request new feature] Add the time of a user become an autoconfirmed user to [Edit Counter] Show time of autoconfirmed promotion in user rights log.Jun 13 2018, 2:05 AM
MusikAnimal moved this task from Working to Pending deployment on the XTools board.
MusikAnimal moved this task from Pending deployment to Complete on the XTools board.

Done! Only took 3 months =P