Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -762,34 +762,33 @@ |
763 | 763 | global $wgAbuseFilterEmergencyDisableThreshold, $wgAbuseFilterEmergencyDisableCount, |
764 | 764 | $wgAbuseFilterEmergencyDisableAge, $wgMemc; |
765 | 765 | |
766 | | - foreach( $filters as $filter => $matched ) { |
767 | | - if ($matched) { |
768 | | - // Increment counter |
769 | | - $matchCount = $wgMemc->get( self::filterMatchesKey( $filter ) ); |
| 766 | + foreach( $filters as $filter ) { |
| 767 | + // Increment counter |
| 768 | + $matchCount = $wgMemc->get( self::filterMatchesKey( $filter ) ); |
770 | 769 | |
771 | | - // Handle missing keys... |
772 | | - if (!$matchCount) { |
773 | | - $wgMemc->set( self::filterMatchesKey( $filter ), 1, self::$statsStoragePeriod ); |
774 | | - } else { |
775 | | - $wgMemc->incr( self::filterMatchesKey( $filter ) ); |
776 | | - } |
777 | | - $matchCount++; |
778 | | - |
779 | | - // Figure out if the filter is subject to being deleted. |
780 | | - $filter_age = wfTimestamp( TS_UNIX, self::$filters[$filter]->af_timestamp ); |
781 | | - $throttle_exempt_time = $filter_age + $wgAbuseFilterEmergencyDisableAge; |
| 770 | + // Handle missing keys... |
| 771 | + if (!$matchCount) { |
| 772 | + $wgMemc->set( self::filterMatchesKey( $filter ), 1, self::$statsStoragePeriod ); |
| 773 | + } else { |
| 774 | + $wgMemc->incr( self::filterMatchesKey( $filter ) ); |
| 775 | + } |
| 776 | + $matchCount++; |
| 777 | + |
| 778 | + // Figure out if the filter is subject to being deleted. |
| 779 | + $filter_age = wfTimestamp( TS_UNIX, |
| 780 | + self::$filters[$filter]->af_timestamp ); |
| 781 | + $throttle_exempt_time = $filter_age + $wgAbuseFilterEmergencyDisableAge; |
782 | 782 | |
783 | | - if ($total && $throttle_exempt_time > time() |
784 | | - && $matchCount > $wgAbuseFilterEmergencyDisableCount |
785 | | - && ($matchCount / $total) > $wgAbuseFilterEmergencyDisableThreshold) |
786 | | - { |
787 | | - // More than $wgAbuseFilterEmergencyDisableCount matches, |
788 | | - // constituting more than $wgAbuseFilterEmergencyDisableThreshold |
789 | | - // (a fraction) of last few edits. Disable it. |
790 | | - $dbw = wfGetDB( DB_MASTER ); |
791 | | - $dbw->update( 'abuse_filter', array( 'af_throttled' => 1 ), |
792 | | - array( 'af_id' => $filter ), __METHOD__ ); |
793 | | - } |
| 783 | + if ($total && $throttle_exempt_time > time() |
| 784 | + && $matchCount > $wgAbuseFilterEmergencyDisableCount |
| 785 | + && ($matchCount / $total) > $wgAbuseFilterEmergencyDisableThreshold) |
| 786 | + { |
| 787 | + // More than $wgAbuseFilterEmergencyDisableCount matches, |
| 788 | + // constituting more than $wgAbuseFilterEmergencyDisableThreshold |
| 789 | + // (a fraction) of last few edits. Disable it. |
| 790 | + $dbw = wfGetDB( DB_MASTER ); |
| 791 | + $dbw->update( 'abuse_filter', array( 'af_throttled' => 1 ), |
| 792 | + array( 'af_id' => $filter ), __METHOD__ ); |
794 | 793 | } |
795 | 794 | } |
796 | 795 | } |