http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90931

Revision: 90931
Author:   aaron
Date:     2011-06-28 02:56:45 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
Follow-up r90819: made XOR only work on two conditions per CR. Give a warning 
if three or more given.

Modified Paths:
--------------
    trunk/phase3/includes/Autopromote.php

Modified: trunk/phase3/includes/Autopromote.php
===================================================================
--- trunk/phase3/includes/Autopromote.php       2011-06-28 02:08:52 UTC (rev 
90930)
+++ trunk/phase3/includes/Autopromote.php       2011-06-28 02:56:45 UTC (rev 
90931)
@@ -104,18 +104,11 @@
 
                                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 ) ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to