r23832 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23831‎ | r23832 | r23833 >
Date:05:59, 7 July 2007
Author:amidaniel
Status:old
Tags:
Comment:
* Deprecation of MakeValidate and validation log.
* Sysops now able to use Special:Userrights to grant and revoke *only* Editor status.
* All modifications to Editor and Reviewer status now logged in the userrights log instead of the validation log, including autopromotion (which is silently logged).

Based upon patch by Prodego. Will remove MakeValidate.php and its dependents separately.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -30,7 +30,6 @@
3131 $wgExtensionFunctions[] = 'efLoadReviewMessages';
3232
3333 # Load promotion UI
34 -include_once('SpecialMakevalidate.php');
3534 # Load review UI
3635 extAddSpecialPage( dirname(__FILE__) . '/FlaggedRevsPage.body.php', 'Revisionreview', 'Revisionreview' );
3736 # Load stableversions UI
@@ -93,6 +92,20 @@
9493 'style' => array('review' => 3),
9594 );
9695
 96+
 97+# Allow sysops to grant and revoke 'editor' status.
 98+$wgGroupPermissions['sysop']['userrights'] = true;
 99+
 100+if (isset($wgAddGroups['sysop']))
 101+ array_push( $wgAddGroups['sysop'], 'editor' );
 102+else
 103+ $wgAddGroups['sysop'] = array( 'editor' );
 104+
 105+if (isset($wgRemoveGroups['sysop']))
 106+ array_push( $wgRemoveGroups['sysop'], 'editor' );
 107+else
 108+ $wgRemoveGroups['sysop'] = array( 'editor' );
 109+
97110 # Use RC Patrolling to check for vandalism
98111 # When revisions are flagged, they count as patrolled
99112 $wgUseRCPatrol = true;
@@ -782,20 +795,26 @@
783796 $vars = $wgFlaggedRevsAutopromote;
784797 if( !in_array('editor',$groups) && $userage >= $vars['days'] && $user->getEditCount() >= $vars['edits']
785798 && ( !$vars['email'] || $wgUser->isAllowed('emailconfirmed') ) ) {
 799+ $fname = 'FlaggedRevs::autoPromoteUser';
 800+
786801 # Do not re-add status if it was previously removed...
787 - $fname = 'FlaggedRevs::autoPromoteUser';
788 - $db = wfGetDB( DB_SLAVE );
789 - $result = $db->select('logging',
790 - array('log_user'),
791 - array("log_type='validate'", "log_action='revoke1'", 'log_namespace' => NS_USER, 'log_title' => $user->getName() ),
792 - $fname,
793 - array('LIMIT' => 1) );
794 - # Add rights if they were never removed
795 - if( !$db->numRows($result) ) {
 802+ $dbw = wfGetDB( DB_MASTER );
 803+ $dbr = $dbw->selectRow( 'logging', 'log_params',
 804+ array(
 805+ 'log_type' => 'rights',
 806+ 'log_title' => $wgUser->getName(),
 807+ "log_params LIKE '%editor%'" ) );
 808+
 809+ if (empty($dbr)) {
 810+ $newGroups = $groups ;
 811+ array_push( $newGroups, 'editor');
 812+
 813+ # Lets NOT spam RC, set $RC to false
 814+ $log = new LogPage( 'rights', false );
 815+ $log->addEntry('rights', $user->getUserPage(), wfMsgHtml('makevalidate-autosum'),
 816+ array( makeGroupNameList( $groups ), makeGroupNameList( $newGroups ) ) );
 817+
796818 $user->addGroup('editor');
797 - # Lets NOT spam RC, set $RC to false
798 - $log = new LogPage( 'validate', false );
799 - $log->addEntry('grant1', $user->getUserPage(), wfMsgHtml('makevalidate-autosum') );
800819 }
801820 }
802821 return true;
@@ -1386,6 +1405,10 @@
13871406
13881407 }
13891408
 1409+function makeGroupNameList( $ids ) {
 1410+ return implode( ', ', $ids );
 1411+}
 1412+
13901413 // Our class instances
13911414 $flaggedRevsModifier = new FlaggedArticle();
13921415 // Main hooks, overrides pages content, adds tags, sets tabs and permalink
@@ -1417,4 +1440,3 @@
14181441 // Additional parser versioning
14191442 $wgHooks['ParserAfterTidy'][] = array( $flaggedRevsModifier, 'parserInjectImageTimestamps');
14201443 $wgHooks['OutputPageParserOutput'][] = array( $flaggedRevsModifier, 'outputInjectImageTimestamps');
1421 -
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php
@@ -3,6 +3,7 @@
44
55 // English (Aaron Schulz)
66 $RevisionreviewMessages['en'] = array(
 7+ 'makevalidate-autosum'=> 'autopromoted',
78 'editor' => 'Editor',
89 'group-editor' => 'Editors',
910 'group-editor-member' => 'Editor',

Follow-up revisions

RevisionCommit summaryAuthorDate
r23836Partial revert/reworking of r23832....amidaniel06:53, 7 July 2007

Status & tagging log