Page MenuHomePhabricator

Edit Count doesn't retroactively update after adjusting $wgNamespacesForEditPoints
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Adjust $wgNamespacesForEditPoints to include more namespaces: $wgNamespacesForEditPoints = [ 0, 2, 4, 6, 8, 10 ];
  2. Go to Special:UpdateEditCounts
  3. See user's edit count on their profile

Actual Results:
Edit count doesn't change to include previous edits. Still shows the edit count from the main namespace but starts counting edits in these other namespaces from now on.

Expected results:
Update the edit count to include previous edits from namespaces listed in $wgNamespacesForEditPoints.

For example, if a user has 300 main namespace edits and 200 template edits, and the template namespace is added to $wgNamespacesForEditPoints afterwards, the edit count should update to show 500 edits instead of only 300.

Event Timeline

Change 935796 had a related patch set uploaded (by Martineznovo; author: Martineznovo):

[mediawiki/extensions/SocialProfile@master] UpdateEditCounts: Fix condition from $wgNamespacesForEditPoints

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

Ciencia_Al_Poder changed the task status from Open to In Progress.Jul 5 2023, 6:39 PM
Ciencia_Al_Poder claimed this task.

When fixing this, debugging the resulting SQL query, I noticed something strange. The default value as defined in extension.json is [ 0 ]. If I set $wgNamespacesForEditPoints = [ 0, 6, 10, 14 ], the resulting query results in [ 0, 0, 6, 10, 14 ] (notice how the value 0 is repeated)

However, there's nothing in the code adding the extra value. If I edit the extension.json file and remove the default value, leaving it into an empty array, the extra 0 disappears.

This looks like the default behavior in the merge_strategy. This means the main namespace can't be excluded. It's a bit shocking. However I doubt anybody wants to exclude main namespace edits from being counted, so I guess it doesn't cause any harm...

Change 935796 merged by jenkins-bot:

[mediawiki/extensions/SocialProfile@master] UpdateEditCounts: Fix condition from $wgNamespacesForEditPoints

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