Re-commit r34072 with some modifications:
[lhc/web/wiklou.git] / includes / Autopromote.php
index 76d6f2a..b166aa7 100644 (file)
@@ -18,7 +18,7 @@ class Autopromote {
                        if( self::recCheckCondition( $cond, $user ) )
                                $promote[] = $group;
                }
-               return array_unique( $promote );
+               return $promote;
        }
 
        /**
@@ -47,7 +47,7 @@ class Autopromote {
                                                return false;
                                return true;
                        } elseif( $cond[0] == '|' ) {
-                               foreach( array_slice( $cond, 1 ) as $subcond ) 
+                               foreach( array_slice( $cond, 1 ) as $subcond )
                                        if( self::recCheckCondition( $subcond, $user ) )
                                                return true;
                                return false;
@@ -98,6 +98,9 @@ class Autopromote {
                        case APCOND_AGE:
                                $age = time() - wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
                                return $age >= $cond[1];
+                       case APCOND_INGROUPS:
+                               $groups = array_slice( $cond, 1 );
+                               return count( array_intersect( $groups, $user->getGroups() ) ) == count( $groups );
                        default:
                                $result = null;
                                wfRunHooks( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) );