Revision: 46056
Author: werdna
Date: 2009-01-23 01:15:43 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
Assorted code quality and usability.
Modified Paths:
--------------
branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php
branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
Modified: branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php
===================================================================
--- branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php
2009-01-23 01:03:23 UTC (rev 46055)
+++ branches/change-tagging/extensions/AbuseFilter/AbuseFilter.i18n.php
2009-01-23 01:15:43 UTC (rev 46056)
@@ -96,6 +96,7 @@
'abusefilter-tools-modifiertest-submit' => 'Test',
'abusefilter-tools' => 'Abuse filter tools',
'abusefilter-loglink' => 'View the abuse log',
+ 'abusefilter-return' => 'Return to filter management',
// Options form
'abusefilter-list-options' => 'Options',
@@ -124,7 +125,7 @@
// The edit screen
'abusefilter-edit-subtitle' => 'Editing filter $1',
'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]]",
- 'abusefilter-edit-status-label' => 'Statistics',
+ 'abusefilter-edit-status-label' => 'Statistics:',
'abusefilter-edit-status' => 'Of the last $1
{{PLURAL:$1|action|actions}}, this filter has matched $2 ($3%).',
'abusefilter-edit-throttled' => "'''Warning''': This filter was
automatically disabled as a safety measure. It reached the limit of matching
more than $1% of actions.",
'abusefilter-edit-new' => 'New filter',
@@ -164,6 +165,7 @@
'abusefilter-edit-viewhistory' => "View this filter's history",
'abusefilter-edit-history' => 'History',
'abusefilter-edit-check' => 'Check syntax',
+ 'abusefilter-edit-badfilter' => 'The filter you specified does not
exist',
// Filter editing helpers
'abusefilter-edit-builder-select' => 'Select an option to add it at the
cursor',
Modified:
branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
===================================================================
---
branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
2009-01-23 01:03:23 UTC (rev 46055)
+++
branches/change-tagging/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
2009-01-23 01:15:43 UTC (rev 46056)
@@ -43,6 +43,7 @@
$dbw->begin();
+ // Insert MAIN row.
if ($filter == 'new') {
$new_id = $dbw->nextSequenceValue(
'abuse_filter_af_id_seq' );
$is_new = true;
@@ -51,10 +52,10 @@
$is_new = false;
}
+ // Reset throttled marker, if we're re-enabling it.
$newRow['af_throttled'] = $newRow['af_throttled'] &&
!$newRow['af_enabled'];
+ $newRow['af_id'] = $new_id; // ID.
- $newRow['af_id'] = $new_id;
-
$dbw->replace( 'abuse_filter', array( 'af_id' ),
$newRow, __METHOD__ );
if ($is_new) {
@@ -109,7 +110,7 @@
// Do the update
$dbw->insert( 'abuse_filter_history', $afh_row,
__METHOD__ );
$dbw->delete( 'abuse_filter_action', array(
'afa_filter' => $filter, 'afa_consequence' => $deadActions ), __METHOD__ );
- $dbw->replace( 'abuse_filter_action', array( array(
'afa_filter', 'afa_consequence' ) ), $actionsRows, __METHOD__ );
+ $dbw->insert( 'abuse_filter_action', $actionsRows,
__METHOD__ );
$dbw->commit();
@@ -138,14 +139,18 @@
global $wgOut,$wgLang,$wgUser;
$sk = $this->mSkin;
+ // Load from request OR database.
list ($row, $actions) = $this->loadRequest($filter,
$history_id);
if( !$row ) {
- return false;
+ $wgOut->addWikiMsg( 'abusefilter-edit-badfilter' );
+ $wgOut->addHTML( $sk->link( $this->getTitle(), wfMsg(
'abusefilter-return' ) ) );
+ return;
}
$wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle',
$filter, $history_id ) );
+ // Hide hidden filters.
if (isset($row->af_hidden) && $row->af_hidden &&
!$this->canEdit()) {
return wfMsg( 'abusefilter-edit-denied' );
}
@@ -247,7 +252,7 @@
'op-arithmetic' => array('+' => 'addition', '-' =>
'subtraction', '*' => 'multiplication', '/' => 'divide', '%' => 'modulo', '**'
=> 'pow'),
'op-comparison' => array('==' => 'equal', '!=' =>
'notequal', '<' => 'lt', '>' => 'gt', '<=' => 'lte', '>=' => 'gte'),
'op-bool' => array( '!' => 'not', '&' => 'and', '|' =>
'or', '^' => 'xor' ),
- 'misc' => array( 'val1 ? iftrue : iffalse' =>
'ternary', 'in' => 'in', 'like' => 'like', '""' => 'stringlit', ),
+ 'misc' => array( 'in' => 'in', 'like' => 'like', '""'
=> 'stringlit', ),
'funcs' => array( 'length(string)' => 'length',
'lcase(string)' => 'lcase', 'ccnorm(string)' => 'ccnorm', 'rmdoubles(string)'
=> 'rmdoubles', 'specialratio(string)' => 'specialratio', 'norm(string)' =>
'norm', 'count(needle,haystack)' => 'count' ),
'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'),
);
@@ -421,7 +426,6 @@
$parameters = array();
if ($action == 'throttle') {
- // Grumble grumble.
// We need to load the parameters
$throttleCount =
$wgRequest->getIntOrNull( 'wpFilterThrottleCount' );
$throttlePeriod =
$wgRequest->getIntOrNull( 'wpFilterThrottlePeriod' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs