Last modified: 2011-06-26 04:12:59 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 T26948, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24948 - FlaggedRevs should not reinvent the autopromote wheel
FlaggedRevs should not reinvent the autopromote wheel
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
FlaggedRevs (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Aaron Schulz
: patch, patch-need-review
Depends on: 25428
Blocks: 25390
  Show dependency treegraph
 
Reported: 2010-08-26 19:52 UTC by Aryeh Gregor (not reading bugmail, please e-mail directly)
Modified: 2011-06-26 04:12 UTC (History)
6 users (show)

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


Attachments
MediaWiki-side patch (12.38 KB, patch)
2010-08-30 10:07 UTC, lampak
Details
MediaWiki-side patch, updated (10.93 KB, patch)
2011-04-28 21:00 UTC, lampak
Details

Description Aryeh Gregor (not reading bugmail, please e-mail directly) 2010-08-26 19:52:56 UTC
$wgFlaggedRevsAutopromote serves a very similar purpose to $wgAutopromote, but it's restricted to the 'editor' group.  Each system implements a bunch of features the other doesn't.  The features of $wgFlaggedRevsAutopromote should be merged into $wgAutopromote, and the former should be dropped (or rather reinterpreted in terms of $wgAutopromote, for back-compat).  Some features of $wgFlaggedRevsAutopromote aren't feasibly implementable on every User::getEffectiveGroups() call, but you could add some new mode that works using explicit groups instead of implicit, and is only checked on certain events like edit.
Comment 1 lampak 2010-08-30 10:07:57 UTC
Created attachment 7660 [details]
MediaWiki-side patch

(discussion which resulted in filing the bug: http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/49447)

I have written the first patch, i.e. the one on MediaWiki core side. 

The autopromotion can be now done like: 
$wgHooks['ArticleSaveComplete'][] = array (
	'Autopromote::autopromoteOnceHook', 
	array( 'somegroup' => array(APCOND_EDITCOUNT, 100) )
);

The format of conditions is the same as $wgAutopromote. The differences are:
* The group can be removed from a user via Special:UserRights. 
* The user is not autopromoted to the groups he/she has once belonged to. 
* The user won't lose the group automatically if he/she no longer meets the criteria. 
* The Autopromote::autopromoteOnceHook() function can be assigned to any hook so autopromotion is "only checked on certain events". The function simply calls a new method User::autopromoteOnce() on $wgUser so if there's such need a custom function may be written. 

My autopromotion mechanism is separate from $wgAutopromote, though it uses the same format of conditions.

And I had to create a new database table: user_former_groups. It's actually a clone of user_groups but stores the groups the user has once belonged to, not necessarily belongs now. 

I haven't tested if the table is created properly on anything different then MySQL (though it should work on sqlite and postgres because it's actually copy-pasted user_groups).
Comment 2 Aaron Schulz 2010-11-23 21:59:58 UTC
The user attributes/tally table (flaggedrevs_autopromote) should be in the core too, so that extensions are not adding new tables for every new attribute they want to check.
Comment 3 Aaron Schulz 2011-03-22 16:53:01 UTC
Is this patch still being maintained?
Comment 4 lampak 2011-04-28 17:24:34 UTC
It can be, if it's needed. 
Besides, I'm not sure if the way of attaching an autopromotion to a hook was the best idea of mine...
Comment 5 lampak 2011-04-28 21:00:34 UTC
Created attachment 8471 [details]
MediaWiki-side patch, updated

Patch updated to the latest svn revision.
Comment 6 Chad H. 2011-04-28 21:53:35 UTC
Should go at the end of the update list under 1.18, not in the middle of the 1.17 list.
Comment 7 Aaron Schulz 2011-05-22 22:03:18 UTC
(In reply to comment #4)
> It can be, if it's needed. 
> Besides, I'm not sure if the way of attaching an autopromotion to a hook was
> the best idea of mine...

It can be useful to only check on certain action for performance reasons.

I've looked at the patch diff above, which is fairly sane. I'm thinking this should be committed soon so that a broader audience will look at it.

With the AutopromoteCondition hook, there is already a way for extensions to add conditions.
Comment 8 Aaron Schulz 2011-06-13 20:56:20 UTC
(In reply to comment #5)
> Created attachment 8471 [details]
> MediaWiki-side patch, updated
> 
> Patch updated to the latest svn revision.

Do you have commit access btw?
Comment 9 Aaron Schulz 2011-06-25 02:06:46 UTC
This patch won't apply well at all with SVN (I can tell from the file names) :/
Comment 10 Aaron Schulz 2011-06-25 02:52:48 UTC
(In reply to comment #9)
> This patch won't apply well at all with SVN (I can tell from the file names) :/

Nevermind, worked around it. Applied in r90749.
Comment 11 Aaron Schulz 2011-06-26 04:12:59 UTC
Largely dealt with in r90816. A few APCONDs could perhaps be moved to core though.

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


Navigation
Links