/**
* 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*
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 ) );
/**
* 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*
* 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
define( 'APCOND_IPINRANGE', 6 );
define( 'APCOND_AGE_FROM_EDIT', 7 );
define( 'APCOND_BLOCKED', 8 );
+define( 'APCOND_ISBOT', 9 );
/**@}*/
* @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;
}
/**
'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',
'rightslogtext',
'rightslogentry',
'rightsnone',
+ 'rightsautocomment',
),
'action' => array(
'action-read',