Last modified: 2012-06-15 14:33:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38492, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36492 - Extension:UserDailyContribs counts null edits as edits
Extension:UserDailyContribs counts null edits as edits
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-03 19:15 UTC by Lejonel
Modified: 2012-06-15 14:33 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to check if a new revision is saved (662 bytes, patch)
2012-05-19 14:08 UTC, Lejonel
Details

Description Lejonel 2012-05-03 19:15:42 UTC
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
Comment 1 Mark A. Hershberger 2012-05-04 14:56:48 UTC
Sounds like you could get a patch together.  If you do, please submit via Gerrit.
Comment 2 Lejonel 2012-05-19 14:08:05 UTC
Created attachment 10624 [details]
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.
Comment 3 Alex Monk 2012-05-19 14:14:32 UTC
Hi Lejonel, please request developer access (see https://www.mediawiki.org/wiki/Developer_access ) and submit your changes for review: https://www.mediawiki.org/wiki/Git/Workflow
Comment 4 Lejonel 2012-05-19 14:37:31 UTC
I already attached a patch here for review
Comment 5 Platonides 2012-05-19 14:55:58 UTC
Your patch wouldn't work. $revision won't be null in a null-edit. It will be a revision object.
Comment 6 Lejonel 2012-05-19 16:23:37 UTC
(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;
Comment 7 Alex Monk 2012-05-19 16:30:19 UTC
I can't find that text anywhere in WikiPage.php. Also, why did you add so many new parameters to articleSaveComplete?
Comment 8 Platonides 2012-05-19 16:44:07 UTC
You are right, I had missed that portion.
Comment 9 Platonides 2012-05-19 16:54:20 UTC
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
Comment 10 Sumana Harihareswara 2012-06-15 14:33:58 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links