r46056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46055‎ | r46056 | r46057 >
Date:01:15, 23 January 2009
Author:werdna
Status:ok
Tags:
Comment:
Assorted code quality and usability.
Modified paths:
  • /branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)

Diff [purge]

Index: branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -43,6 +43,7 @@
4444
4545 $dbw->begin();
4646
 47+ // Insert MAIN row.
4748 if ($filter == 'new') {
4849 $new_id = $dbw->nextSequenceValue( 'abuse_filter_af_id_seq' );
4950 $is_new = true;
@@ -51,10 +52,10 @@
5253 $is_new = false;
5354 }
5455
 56+ // Reset throttled marker, if we're re-enabling it.
5557 $newRow['af_throttled'] = $newRow['af_throttled'] && !$newRow['af_enabled'];
 58+ $newRow['af_id'] = $new_id; // ID.
5659
57 - $newRow['af_id'] = $new_id;
58 -
5960 $dbw->replace( 'abuse_filter', array( 'af_id' ), $newRow, __METHOD__ );
6061
6162 if ($is_new) {
@@ -109,7 +110,7 @@
110111 // Do the update
111112 $dbw->insert( 'abuse_filter_history', $afh_row, __METHOD__ );
112113 $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__ );
114115
115116 $dbw->commit();
116117
@@ -138,14 +139,18 @@
139140 global $wgOut,$wgLang,$wgUser;
140141 $sk = $this->mSkin;
141142
 143+ // Load from request OR database.
142144 list ($row, $actions) = $this->loadRequest($filter, $history_id);
143145
144146 if( !$row ) {
145 - return false;
 147+ $wgOut->addWikiMsg( 'abusefilter-edit-badfilter' );
 148+ $wgOut->addHTML( $sk->link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) );
 149+ return;
146150 }
147151
148152 $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) );
149153
 154+ // Hide hidden filters.
150155 if (isset($row->af_hidden) && $row->af_hidden && !$this->canEdit()) {
151156 return wfMsg( 'abusefilter-edit-denied' );
152157 }
@@ -247,7 +252,7 @@
248253 'op-arithmetic' => array('+' => 'addition', '-' => 'subtraction', '*' => 'multiplication', '/' => 'divide', '%' => 'modulo', '**' => 'pow'),
249254 'op-comparison' => array('==' => 'equal', '!=' => 'notequal', '<' => 'lt', '>' => 'gt', '<=' => 'lte', '>=' => 'gte'),
250255 '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', ),
252257 'funcs' => array( 'length(string)' => 'length', 'lcase(string)' => 'lcase', 'ccnorm(string)' => 'ccnorm', 'rmdoubles(string)' => 'rmdoubles', 'specialratio(string)' => 'specialratio', 'norm(string)' => 'norm', 'count(needle,haystack)' => 'count' ),
253258 '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'),
254259 );
@@ -421,7 +426,6 @@
422427 $parameters = array();
423428
424429 if ($action == 'throttle') {
425 - // Grumble grumble.
426430 // We need to load the parameters
427431 $throttleCount = $wgRequest->getIntOrNull( 'wpFilterThrottleCount' );
428432 $throttlePeriod = $wgRequest->getIntOrNull( 'wpFilterThrottlePeriod' );
Index: branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -96,6 +96,7 @@
9797 'abusefilter-tools-modifiertest-submit' => 'Test',
9898 'abusefilter-tools' => 'Abuse filter tools',
9999 'abusefilter-loglink' => 'View the abuse log',
 100+ 'abusefilter-return' => 'Return to filter management',
100101
101102 // Options form
102103 'abusefilter-list-options' => 'Options',
@@ -124,7 +125,7 @@
125126 // The edit screen
126127 'abusefilter-edit-subtitle' => 'Editing filter $1',
127128 '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> &bull; [[Special:AbuseFilter/history/$2|Return to this filter's history]]",
128 - 'abusefilter-edit-status-label' => 'Statistics',
 129+ 'abusefilter-edit-status-label' => 'Statistics:',
129130 'abusefilter-edit-status' => 'Of the last $1 {{PLURAL:$1|action|actions}}, this filter has matched $2 ($3%).',
130131 'abusefilter-edit-throttled' => "'''Warning''': This filter was automatically disabled as a safety measure. It reached the limit of matching more than $1% of actions.",
131132 'abusefilter-edit-new' => 'New filter',
@@ -164,6 +165,7 @@
165166 'abusefilter-edit-viewhistory' => "View this filter's history",
166167 'abusefilter-edit-history' => 'History',
167168 'abusefilter-edit-check' => 'Check syntax',
 169+ 'abusefilter-edit-badfilter' => 'The filter you specified does not exist',
168170
169171 // Filter editing helpers
170172 'abusefilter-edit-builder-select' => 'Select an option to add it at the cursor',

Status & tagging log