Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -30,7 +30,6 @@ |
31 | 31 | $wgExtensionFunctions[] = 'efLoadReviewMessages'; |
32 | 32 | |
33 | 33 | # Load promotion UI |
34 | | -include_once('SpecialMakevalidate.php'); |
35 | 34 | # Load review UI |
36 | 35 | extAddSpecialPage( dirname(__FILE__) . '/FlaggedRevsPage.body.php', 'Revisionreview', 'Revisionreview' ); |
37 | 36 | # Load stableversions UI |
— | — | @@ -93,6 +92,20 @@ |
94 | 93 | 'style' => array('review' => 3), |
95 | 94 | ); |
96 | 95 | |
| 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 | + |
97 | 110 | # Use RC Patrolling to check for vandalism |
98 | 111 | # When revisions are flagged, they count as patrolled |
99 | 112 | $wgUseRCPatrol = true; |
— | — | @@ -782,20 +795,26 @@ |
783 | 796 | $vars = $wgFlaggedRevsAutopromote; |
784 | 797 | if( !in_array('editor',$groups) && $userage >= $vars['days'] && $user->getEditCount() >= $vars['edits'] |
785 | 798 | && ( !$vars['email'] || $wgUser->isAllowed('emailconfirmed') ) ) { |
| 799 | + $fname = 'FlaggedRevs::autoPromoteUser'; |
| 800 | + |
786 | 801 | # 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 | + |
796 | 818 | $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') ); |
800 | 819 | } |
801 | 820 | } |
802 | 821 | return true; |
— | — | @@ -1386,6 +1405,10 @@ |
1387 | 1406 | |
1388 | 1407 | } |
1389 | 1408 | |
| 1409 | +function makeGroupNameList( $ids ) { |
| 1410 | + return implode( ', ', $ids ); |
| 1411 | +} |
| 1412 | + |
1390 | 1413 | // Our class instances |
1391 | 1414 | $flaggedRevsModifier = new FlaggedArticle(); |
1392 | 1415 | // Main hooks, overrides pages content, adds tags, sets tabs and permalink |
— | — | @@ -1417,4 +1440,3 @@ |
1418 | 1441 | // Additional parser versioning |
1419 | 1442 | $wgHooks['ParserAfterTidy'][] = array( $flaggedRevsModifier, 'parserInjectImageTimestamps'); |
1420 | 1443 | $wgHooks['OutputPageParserOutput'][] = array( $flaggedRevsModifier, 'outputInjectImageTimestamps'); |
1421 | | - |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php |
— | — | @@ -3,6 +3,7 @@ |
4 | 4 | |
5 | 5 | // English (Aaron Schulz) |
6 | 6 | $RevisionreviewMessages['en'] = array( |
| 7 | + 'makevalidate-autosum'=> 'autopromoted', |
7 | 8 | 'editor' => 'Editor', |
8 | 9 | 'group-editor' => 'Editors', |
9 | 10 | 'group-editor-member' => 'Editor', |