From 1cc89122ac832ddfdc4f58a61afce988d866e91a Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sat, 7 Jun 2008 05:13:25 +0000 Subject: [PATCH] Add a ! operator to autopromote conditions --- includes/Autopromote.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/Autopromote.php b/includes/Autopromote.php index 4b1c6fa76e..68fe66363d 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -41,7 +41,7 @@ class Autopromote { * @return bool Whether the condition is true */ private static function recCheckCondition( $cond, User $user ) { - $validOps = array( '&', '|', '^' ); + $validOps = array( '&', '|', '^', '!' ); if( is_array( $cond ) && count( $cond ) >= 2 && in_array( $cond[0], $validOps ) ) { # Recursive condition if( $cond[0] == '&' ) { @@ -63,6 +63,11 @@ class Autopromote { $res = ($res xor self::recCheckCondition( $subcond, $user )); } return $res; + } elseif ( $cond[0] = '!' ) { + foreach( array_slice( $cond, 1 ) as $subcond ) + if( self::recCheckCondition( $subcond, $user ) ) + return false; + return true; } } # If we got here, the array presumably does not contain other condi- -- 2.20.1