r41145 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41144‎ | r41145 | r41146 >
Date:09:16, 22 September 2008
Author:werdna
Status:old
Tags:
Comment:
Add a hacky tool for restoring autoconfirmed status when it's blocked by a filter. Don't expect it to get much use, so I haven't put much effort in. It gets the job done, though.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/SpecialAbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/abusefilter.tables.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -69,4 +69,5 @@
7070 $wgAbuseFilterNativeExpressionEvaluator = "$dir/parser_native/af_expr";
7171
7272 $wgAjaxExportList[] = 'AbuseFilter::ajaxCheckSyntax';
73 -$wgAjaxExportList[] = 'AbuseFilter::ajaxEvaluateExpression';
\ No newline at end of file
 73+$wgAjaxExportList[] = 'AbuseFilter::ajaxEvaluateExpression';
 74+$wgAjaxExportList[] = 'AbuseFilter::ajaxReAutoconfirm';
\ No newline at end of file
Index: trunk/extensions/AbuseFilter/SpecialAbuseFilter.php
@@ -152,9 +152,28 @@
153153
154154 var el = document.getElementById( 'mw-abusefilter-expr-result' );
155155 changeText( el, response );
156 - }";
 156+ }
 157+ function doReautoSubmit()
 158+ {
 159+ var name = document.getElementById('reautoconfirm-user').value;
 160+ injectSpinner( document.getElementById( 'mw-abusefilter-reautoconfirmsubmit' ), 'abusefilter-reautoconfirm' );
 161+ sajax_do_call( 'AbuseFilter::ajaxReAutoconfirm', [name], processReautoconfirm );
 162+ }
 163+ function processReautoconfirm( request ) {
 164+ var response = request.responseText;
 165+
 166+ removeSpinner( 'abusefilter-reautoconfirm' );
 167+ }
 168+ ";
157169
158170 $wgOut->addInlineScript( $exprScript );
 171+
 172+ // Hacky little box to re-enable autoconfirmed if it got disabled
 173+ $rac = '';
 174+ $rac .= Xml::inputLabel( wfMsg( 'abusefilter-tools-reautoconfirm-user' ), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45 );
 175+ $rac .= Xml::element( 'input', array( 'type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'onclick' => 'doReautoSubmit();', 'value' => wfMsg( 'abusefilter-tools-reautoconfirm-submit' ) ) );
 176+ $rac = Xml::fieldset( wfMsg( 'abusefilter-tools-reautoconfirm' ), $rac );
 177+ $wgOut->addHtml( $rac );
159178 }
160179
161180 function showStatus() {
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -91,6 +91,14 @@
9292 return $parser->evaluateExpression( $expr );
9393 }
9494
 95+ public static function ajaxReAutoconfirm( $username ) {
 96+ $u = User::newFromName( $username );
 97+
 98+ global $wgMemc;
 99+ $k = AbuseFilter::autoPromoteBlockKey($u);
 100+ $wgMemc->delete( $k );
 101+ }
 102+
95103 public static function ajaxEvaluateExpression( $expr ) {
96104 return self::evaluateExpression( $expr );
97105 }
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -103,6 +103,9 @@
104104 'abusefilter-tools-text' => 'Here are some tools which may be useful in formulating and debugging abuse filters. [[Special:AbuseFilter|Return to main menu]]',
105105 'abusefilter-tools-expr' => 'Expression tester',
106106 'abusefilter-tools-submitexpr' => 'Evaluate',
 107+ 'abusefilter-tools-reautoconfirm' => 'Restore autoconfirmed status',
 108+ 'abusefilter-tools-reautoconfirm-user' => 'User',
 109+ 'abusefilter-tools-reautoconfirm-submit' => 'Re-autoconfirm',
107110
108111 // Abuse filter status
109112 'abusefilter-status' => "Of the last $1 {{PLURAL:$1|action|actions}}, $2 ($3%) {{PLURAL:$2|has|have}} reached the condition limit of $4. $5 ($6%) {{PLURAL:$5|has|have}} matched one of the filters currently enabled.",
Index: trunk/extensions/AbuseFilter/abusefilter.tables.sql
@@ -59,6 +59,7 @@
6060 afh_flags TINYBLOB NOT NULL,
6161 afh_public_comments TINYBLOB,
6262 afh_actions BLOB,
 63+ afh_deleted tinyint(1) NOT NULL DEFAULT 0,
6364
6465 PRIMARY KEY (afh_id),
6566 KEY (afh_filter),

Follow-up revisions

RevisionCommit summaryAuthorDate
r41153Revert r41145. Restoring autoconfirmed should really have access control, eh?werdna14:07, 22 September 2008