Index: branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | |
45 | 45 | $dbw->begin(); |
46 | 46 | |
| 47 | + // Insert MAIN row. |
47 | 48 | if ($filter == 'new') { |
48 | 49 | $new_id = $dbw->nextSequenceValue( 'abuse_filter_af_id_seq' ); |
49 | 50 | $is_new = true; |
— | — | @@ -51,10 +52,10 @@ |
52 | 53 | $is_new = false; |
53 | 54 | } |
54 | 55 | |
| 56 | + // Reset throttled marker, if we're re-enabling it. |
55 | 57 | $newRow['af_throttled'] = $newRow['af_throttled'] && !$newRow['af_enabled']; |
| 58 | + $newRow['af_id'] = $new_id; // ID. |
56 | 59 | |
57 | | - $newRow['af_id'] = $new_id; |
58 | | - |
59 | 60 | $dbw->replace( 'abuse_filter', array( 'af_id' ), $newRow, __METHOD__ ); |
60 | 61 | |
61 | 62 | if ($is_new) { |
— | — | @@ -109,7 +110,7 @@ |
110 | 111 | // Do the update |
111 | 112 | $dbw->insert( 'abuse_filter_history', $afh_row, __METHOD__ ); |
112 | 113 | $dbw->delete( 'abuse_filter_action', array( 'afa_filter' => $filter, 'afa_consequence' => $deadActions ), __METHOD__ ); |
113 | | - $dbw->replace( 'abuse_filter_action', array( array( 'afa_filter', 'afa_consequence' ) ), $actionsRows, __METHOD__ ); |
| 114 | + $dbw->insert( 'abuse_filter_action', $actionsRows, __METHOD__ ); |
114 | 115 | |
115 | 116 | $dbw->commit(); |
116 | 117 | |
— | — | @@ -138,14 +139,18 @@ |
139 | 140 | global $wgOut,$wgLang,$wgUser; |
140 | 141 | $sk = $this->mSkin; |
141 | 142 | |
| 143 | + // Load from request OR database. |
142 | 144 | list ($row, $actions) = $this->loadRequest($filter, $history_id); |
143 | 145 | |
144 | 146 | if( !$row ) { |
145 | | - return false; |
| 147 | + $wgOut->addWikiMsg( 'abusefilter-edit-badfilter' ); |
| 148 | + $wgOut->addHTML( $sk->link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) ); |
| 149 | + return; |
146 | 150 | } |
147 | 151 | |
148 | 152 | $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) ); |
149 | 153 | |
| 154 | + // Hide hidden filters. |
150 | 155 | if (isset($row->af_hidden) && $row->af_hidden && !$this->canEdit()) { |
151 | 156 | return wfMsg( 'abusefilter-edit-denied' ); |
152 | 157 | } |
— | — | @@ -247,7 +252,7 @@ |
248 | 253 | 'op-arithmetic' => array('+' => 'addition', '-' => 'subtraction', '*' => 'multiplication', '/' => 'divide', '%' => 'modulo', '**' => 'pow'), |
249 | 254 | 'op-comparison' => array('==' => 'equal', '!=' => 'notequal', '<' => 'lt', '>' => 'gt', '<=' => 'lte', '>=' => 'gte'), |
250 | 255 | 'op-bool' => array( '!' => 'not', '&' => 'and', '|' => 'or', '^' => 'xor' ), |
251 | | - 'misc' => array( 'val1 ? iftrue : iffalse' => 'ternary', 'in' => 'in', 'like' => 'like', '""' => 'stringlit', ), |
| 256 | + 'misc' => array( 'in' => 'in', 'like' => 'like', '""' => 'stringlit', ), |
252 | 257 | 'funcs' => array( 'length(string)' => 'length', 'lcase(string)' => 'lcase', 'ccnorm(string)' => 'ccnorm', 'rmdoubles(string)' => 'rmdoubles', 'specialratio(string)' => 'specialratio', 'norm(string)' => 'norm', 'count(needle,haystack)' => 'count' ), |
253 | 258 | 'vars' => array( 'ACCOUNTNAME' => 'accountname', 'ACTION' => 'action', 'ADDED_LINES' => 'addedlines', 'EDIT_DELTA' => 'delta', 'EDIT_DIFF' => 'diff', 'NEW_SIZE' => 'newsize', 'OLD_SIZE' => 'oldsize', 'REMOVED_LINES' => 'removedlines', 'SUMMARY' => 'summary', 'ARTICLE_ARTICLEID' => 'article-id', 'ARTICLE_NAMESPACE' => 'article-ns', 'ARTICLE_TEXT' => 'article-text', 'ARTICLE_PREFIXEDTEXT' => 'article-prefixedtext', 'MOVED_FROM_ARTICLEID' => 'movedfrom-id', 'MOVED_FROM_NAMESPACE' => 'movedfrom-ns', 'MOVED_FROM_TEXT' => 'movedfrom-text', 'MOVED_FROM_PREFIXEDTEXT' => 'movedfrom-prefixedtext', 'MOVED_TO_ARTICLEID' => 'movedto-id', 'MOVED_TO_NAMESPACE' => 'movedto-ns', 'MOVED_TO_TEXT' => 'movedto-text', 'MOVED_TO_PREFIXEDTEXT' => 'movedto-prefixedtext', 'USER_EDITCOUNT' => 'user-editcount', 'USER_AGE' => 'user-age', 'USER_NAME' => 'user-name', 'USER_GROUPS' => 'user-groups', 'USER_EMAILCONFIRM' => 'user-emailconfirm'), |
254 | 259 | ); |
— | — | @@ -421,7 +426,6 @@ |
422 | 427 | $parameters = array(); |
423 | 428 | |
424 | 429 | if ($action == 'throttle') { |
425 | | - // Grumble grumble. |
426 | 430 | // We need to load the parameters |
427 | 431 | $throttleCount = $wgRequest->getIntOrNull( 'wpFilterThrottleCount' ); |
428 | 432 | $throttlePeriod = $wgRequest->getIntOrNull( 'wpFilterThrottlePeriod' ); |
Index: branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php |
— | — | @@ -96,6 +96,7 @@ |
97 | 97 | 'abusefilter-tools-modifiertest-submit' => 'Test', |
98 | 98 | 'abusefilter-tools' => 'Abuse filter tools', |
99 | 99 | 'abusefilter-loglink' => 'View the abuse log', |
| 100 | + 'abusefilter-return' => 'Return to filter management', |
100 | 101 | |
101 | 102 | // Options form |
102 | 103 | 'abusefilter-list-options' => 'Options', |
— | — | @@ -124,7 +125,7 @@ |
125 | 126 | // The edit screen |
126 | 127 | 'abusefilter-edit-subtitle' => 'Editing filter $1', |
127 | 128 | 'abusefilter-edit-oldwarning' => "<strong>You are editing an old version of this filter. The statistics quoted are for the most recent version of the filter. If you save your changes, you will overwrite all changes since the revision you are editing.</strong> • [[Special:AbuseFilter/history/$2|Return to this filter's history]]", |
128 | | - 'abusefilter-edit-status-label' => 'Statistics', |
| 129 | + 'abusefilter-edit-status-label' => 'Statistics:', |
129 | 130 | 'abusefilter-edit-status' => 'Of the last $1 {{PLURAL:$1|action|actions}}, this filter has matched $2 ($3%).', |
130 | 131 | 'abusefilter-edit-throttled' => "'''Warning''': This filter was automatically disabled as a safety measure. It reached the limit of matching more than $1% of actions.", |
131 | 132 | 'abusefilter-edit-new' => 'New filter', |
— | — | @@ -164,6 +165,7 @@ |
165 | 166 | 'abusefilter-edit-viewhistory' => "View this filter's history", |
166 | 167 | 'abusefilter-edit-history' => 'History', |
167 | 168 | 'abusefilter-edit-check' => 'Check syntax', |
| 169 | + 'abusefilter-edit-badfilter' => 'The filter you specified does not exist', |
168 | 170 | |
169 | 171 | // Filter editing helpers |
170 | 172 | 'abusefilter-edit-builder-select' => 'Select an option to add it at the cursor', |