* Core:
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 26 Jun 2011 04:12:05 +0000 (04:12 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 26 Jun 2011 04:12:05 +0000 (04:12 +0000)
** Made addAutopromoteOnceGroups() put in a user rights log entry
** Added APCOND_ISBOT cond to autopromote and updated some docs
* FlaggedRevs:
** (bug 24948) Made $wgFlaggedRevsAutopromote a wrapper around $wgAutopromoteOnce and removed maybeMakeEditor()/recordDemote() (uses r90749)
** Split off new efSetFlaggedRevsOldAutopromoteConfig function
** Removed calls to FlaggedRevs class in setup function to avoid overhead
** Made cache keys in checkAutoPromoteCond() properly unique
** Made wasPreviouslyBlocked() protected and tweaked editSpacingCheck() param order

includes/Autopromote.php
includes/DefaultSettings.php
includes/Defines.php
includes/User.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 9e8c049..bdb2cb0 100644 (file)
@@ -68,7 +68,7 @@ class Autopromote {
 
        /**
         * Recursively check a condition.  Conditions are in the form
-        *   array( '&' or '|' or '^', cond1, cond2, ... )
+        *   array( '&' or '|' or '^' or '!', cond1, cond2, ... )
         * where cond1, cond2, ... are themselves conditions; *OR*
         *   APCOND_EMAILCONFIRMED, *OR*
         *   array( APCOND_EMAILCONFIRMED ), *OR*
@@ -176,6 +176,8 @@ class Autopromote {
                                return IP::isInRange( wfGetIP(), $cond[1] );
                        case APCOND_BLOCKED:
                                return $user->isBlocked();
+                       case APCOND_ISBOT:
+                               return in_array( 'bot', User::getGroupPermissions( $user->getGroups() ) );
                        default:
                                $result = null;
                                wfRunHooks( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) );
index 723ef4e..85a0a9e 100644 (file)
@@ -3498,7 +3498,7 @@ $wgAutoConfirmCount = 0;
 /**
  * Automatically add a usergroup to any user who matches certain conditions.
  * The format is
- *   array( '&' or '|' or '^', cond1, cond2, ... )
+ *   array( '&' or '|' or '^' or '!', cond1, cond2, ... )
  * where cond1, cond2, ... are themselves conditions; *OR*
  *   APCOND_EMAILCONFIRMED, *OR*
  *   array( APCOND_EMAILCONFIRMED ), *OR*
@@ -3509,6 +3509,7 @@ $wgAutoConfirmCount = 0;
  *   array( APCOND_IPINRANGE, range ), *OR*
  *   array( APCOND_AGE_FROM_EDIT, seconds since first edit ), *OR*
  *   array( APCOND_BLOCKED ), *OR*
+ *   array( APCOND_ISBOT ), *OR*
  *   similar constructs defined by extensions.
  *
  * If $wgEmailAuthentication is off, APCOND_EMAILCONFIRMED will be true for any
index b4a8d7b..4b52bf9 100644 (file)
@@ -249,4 +249,5 @@ define( 'APCOND_ISIP', 5 );
 define( 'APCOND_IPINRANGE', 6 );
 define( 'APCOND_AGE_FROM_EDIT', 7 );
 define( 'APCOND_BLOCKED', 8 );
+define( 'APCOND_ISBOT', 9 );
 /**@}*/
index 9e64812..2660356 100644 (file)
@@ -1117,14 +1117,25 @@ class User {
         * @see $wgAutopromoteOnce
         */
        public function addAutopromoteOnceGroups( $event ) {
+               $toPromote = array();
                if ( $this->getId() ) {
                        $toPromote = Autopromote::getAutopromoteOnceGroups( $this, $event );
-                       foreach ( $toPromote as $group ) {
-                               $this->addGroup( $group );
+                       if ( count( $toPromote ) ) {
+                               $oldGroups = $this->getGroups(); // previous groups
+                               foreach ( $toPromote as $group ) {
+                                       $this->addGroup( $group );
+                               }
+                               $newGroups = array_merge( $oldGroups, $toPromote ); // all groups
+
+                               $log = new LogPage( 'rights', false /* not in RC */ );
+                               $log->addEntry( 'rights',
+                                       $this->getUserPage(),
+                                       wfMsgForContent( 'rightsautocomment' ),
+                                       array( implode( ', ', $oldGroups ), implode( ', ', $newGroups ) )
+                               );
                        }
-                       return $toPromote;
                }
-               return array()
+               return $toPromote
        }
 
        /**
index 61f1f7d..b9325a7 100644 (file)
@@ -1978,10 +1978,11 @@ Your e-mail address is not revealed when other users contact you.',
 'right-sendemail'             => 'Send e-mail to other users',
 
 # User rights log
-'rightslog'      => 'User rights log',
-'rightslogtext'  => 'This is a log of changes to user rights.',
-'rightslogentry' => 'changed group membership for $1 from $2 to $3',
-'rightsnone'     => '(none)',
+'rightslog'          => 'User rights log',
+'rightslogtext'      => 'This is a log of changes to user rights.',
+'rightslogentry'     => 'changed group membership for $1 from $2 to $3',
+'rightsnone'         => '(none)',
+'rightsautocomment'  => 'automatically promoted',
 
 # Associated actions - in the sentence "You do not have permission to X"
 'action-read'                 => 'read this page',
index 2474420..d620d76 100644 (file)
@@ -1143,6 +1143,7 @@ $wgMessageStructure = array(
                'rightslogtext',
                'rightslogentry',
                'rightsnone',
+               'rightsautocomment',
        ),
        'action' => array(
                'action-read',