r35983 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35982‎ | r35983 | r35984 >
Date:05:13, 7 June 2008
Author:werdna
Status:old
Tags:
Comment:
Add a ! operator to autopromote conditions
Modified paths:
  • /trunk/phase3/includes/Autopromote.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Autopromote.php
@@ -41,7 +41,7 @@
4242 * @return bool Whether the condition is true
4343 */
4444 private static function recCheckCondition( $cond, User $user ) {
45 - $validOps = array( '&', '|', '^' );
 45+ $validOps = array( '&', '|', '^', '!' );
4646 if( is_array( $cond ) && count( $cond ) >= 2 && in_array( $cond[0], $validOps ) ) {
4747 # Recursive condition
4848 if( $cond[0] == '&' ) {
@@ -63,6 +63,11 @@
6464 $res = ($res xor self::recCheckCondition( $subcond, $user ));
6565 }
6666 return $res;
 67+ } elseif ( $cond[0] = '!' ) {
 68+ foreach( array_slice( $cond, 1 ) as $subcond )
 69+ if( self::recCheckCondition( $subcond, $user ) )
 70+ return false;
 71+ return true;
6772 }
6873 }
6974 # If we got here, the array presumably does not contain other condi-

Follow-up revisions

RevisionCommit summaryAuthorDate
r74727Fixup "} elseif ( $cond[0] = '!' ) {" from r35983...reedy19:01, 13 October 2010

Status & tagging log