Index: trunk/extensions/AbuseFilter/AbuseFilter.php |
— | — | @@ -166,3 +166,5 @@ |
167 | 167 | |
168 | 168 | // Block duration |
169 | 169 | $wgAbuseFilterBlockDuration = 'indefinite'; |
| 170 | + |
| 171 | +$wgAbuseFilterCustomActionsHandlers = false; |
\ No newline at end of file |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -935,6 +935,8 @@ |
936 | 936 | public static function takeConsequenceAction( $action, $parameters, $title, |
937 | 937 | $vars, $rule_desc ) |
938 | 938 | { |
| 939 | + global $wgAbuseFilterCustomActionsHandlers; |
| 940 | + |
939 | 941 | $display = ''; |
940 | 942 | switch ( $action ) { |
941 | 943 | case 'disallow': |
— | — | @@ -1073,6 +1075,18 @@ |
1074 | 1076 | AbuseFilter::$tagsToSet[$actionID] = $parameters; |
1075 | 1077 | break; |
1076 | 1078 | default: |
| 1079 | + if( is_array( $wgAbuseFilterCustomActionsHandlers ) && |
| 1080 | + in_array( $action, array_keys( $wgAbuseFilterCustomActionsHandlers ) ) ) |
| 1081 | + { |
| 1082 | + $custom_function = $wgAbuseFilterCustomActionsHandlers[$action]; |
| 1083 | + if( is_callable( $custom_function ) ) { |
| 1084 | + $ok = call_user_func( $custom_function, $action, $parameters, $title, $vars, $rule_desc ); |
| 1085 | + } |
| 1086 | + if( $ok ) { |
| 1087 | + $display .= wfMsgExt( 'abusefilter-' . $action, 'parseinline', array() ) . "<br />\n"; |
| 1088 | + } |
| 1089 | + break; |
| 1090 | + } |
1077 | 1091 | wfDebugLog( 'AbuseFilter', "Unrecognised action $action" ); |
1078 | 1092 | } |
1079 | 1093 | |