Page MenuHomePhabricator

Extension:UserDailyContribs counts null edits as edits
Closed, ResolvedPublic

Description

The extensions UserDailyContribs seems to include null edits in its edit counts.

This can be seen at [1] where the edit count for the last 180 days is larger than the total edit count for the user.

I think it is caused by the ArticleSaveComplete function in UserDailyContribs.hooks.php[2]. That function updates the count without checking if any change was made. I think such checks can be made with $revision or $status of the ArticleSaveComplete hook[3].

[1] http://sv.wikipedia.org/w/api.php?action=userdailycontribs&user=ErfgoedBot&daysago=180&format=xml

[2] http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/UserDailyContribs/UserDailyContribs.hooks.php?revision=91244&view=markup#l38

[3] http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSaveComplete


Version: unspecified
Severity: normal

Details

Reference
bz36492

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:21 AM
bzimport set Reference to bz36492.
bzimport added a subscriber: Unknown Object (MLST).

Sounds like you could get a patch together. If you do, please submit via Gerrit.

Patch to check if a new revision is saved

This patch will correct future counting. But old counts already in the database will still be incorrect.

Attached:

I already attached a patch here for review

Your patch wouldn't work. $revision won't be null in a null-edit. It will be a revision object.

(In reply to comment #5)

It worked on my test wiki. Documentation at mediawiki.org for ArticleSaveComplete says $revision is null if no change is made, and WikiPage.php contains:

1397 if ( !$changed ) {
1398 $status->warning( 'edit-no-change' );
1399 $revision = null;

I can't find that text anywhere in WikiPage.php. Also, why did you add so many new parameters to articleSaveComplete?

You are right, I had missed that portion.

You're still using svn. Your working copy missed for instance https://gerrit.wikimedia.org/r/7259

Patch merged and pushed in https://gerrit.wikimedia.org/r/8018

sumanah wrote:

Thanks for the patch, Lejonel! The patch has now been merged. I highly recommend you get Git access https://www.mediawiki.org/wiki/Developer_access ) and submit future changes via Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial