From: Aaron Schulz Date: Tue, 28 Jun 2011 02:56:45 +0000 (+0000) Subject: Follow-up r90819: made XOR only work on two conditions per CR. Give a warning if... X-Git-Tag: 1.31.0-rc.0~29233 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=4ff2590688956d4f5b03621e262eaa59811276cc;p=lhc%2Fweb%2Fwiklou.git Follow-up r90819: made XOR only work on two conditions per CR. Give a warning if three or more given. --- diff --git a/includes/Autopromote.php b/includes/Autopromote.php index fa54edbb72..83f3c20b5f 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -104,18 +104,11 @@ class Autopromote { return false; } elseif ( $cond[0] == '^' ) { // XOR (exactly one cond passes) - $res = false; - foreach ( array_slice( $cond, 1 ) as $subcond ) { - if ( self::recCheckCondition( $subcond, $user ) ) { - if ( $res ) { - return false; - } else { - $res = true; - } - } + if ( count( $cond ) > 3 ) { + wfWarn( 'recCheckCondition() given XOR ("^") condition on three or more conditions. Check your $wgAutopromote and $wgAutopromoteOnce settings.' ); } - - return $res; + return self::recCheckCondition( $cond[1], $user ) + xor self::recCheckCondition( $cond[2], $user ); } elseif ( $cond[0] == '!' ) { // NOT (no conds pass) foreach ( array_slice( $cond, 1 ) as $subcond ) { if ( self::recCheckCondition( $subcond, $user ) ) {