r40980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40979‎ | r40980 | r40981 >
Date:13:33, 18 September 2008
Author:werdna
Status:old
Tags:
Comment:
Minor fix for last commit, and add DeleteQueue support.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.hooks.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/SpecialAbuseLog.php
@@ -76,9 +76,9 @@
7777 // Generate conditions list.
7878 $conds = array();
7979
80 - if ($this->mSearchUser)
 80+ if (!empty($this->mSearchUser))
8181 $conds['afl_user_text'] = $this->mSearchUser;
82 - if ($this->mSearchFilter)
 82+ if (!empty($this->mSearchFilter))
8383 $conds['afl_filter'] = $this->mSearchFilter;
8484
8585 $searchTitle = Title::newFromText( $this->mSearchTitle );
Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -43,6 +43,7 @@
4444 $wgHooks['AbortNewAccount'][] = 'AbuseFilterHooks::onAbortNewAccount';
4545 $wgHooks['ArticleDelete'][] = 'AbuseFilterHooks::onArticleDelete';
4646 $wgHooks['LoadExtensionSchemaUpdates'][] = 'AbuseFilterHooks::onSchemaUpdate';
 47+$wgHooks['AbortDeleteQueueNominate'][] = 'AbuseFilterHooks::onAbortDeleteQueueNominate';
4748
4849 $wgAvailableRights[] = 'abusefilter-modify';
4950 $wgAvailableRights[] = 'abusefilter-log-detail';
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -318,7 +318,7 @@
319319 $logParams[] = 'nocreate, angry-autoblock';
320320
321321 $log = new LogPage( 'block' );
322 - $log->addEntry( 'block', SpecialPage::getTitleFor( 'Contributions', $range ),
 322+ $log->addEntry( 'block', Title::makeTitle( NS_USER, $range ),
323323 wfMsgForContent( 'abusefilter-blockreason', $rule_desc ), $logParams, self::getFilterUser() );
324324
325325 $display .= wfMsgNoTrans( 'abusefilter-blocked-display', $rule_desc ) ."<br />\n";
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -120,4 +120,18 @@
121121
122122 return true;
123123 }
 124+
 125+ public static function onAbortDeleteQueueNominate( $user, $article, $queue, $reason, &$error ) {
 126+ $vars = array();
 127+
 128+ $vars = array_merge( $vars, AbuseFilter::generateUserVars( $user ), AbuseFilter::generateTitleVars( $article->mTitle, 'ARTICLE' ) );
 129+ $vars['SUMMARY'] = $reason;
 130+ $vars['ACTION'] = 'delnom';
 131+ $vars['QUEUE'] = $queue;
 132+
 133+ $filter_result = AbuseFilter::filterAction( $vars, $article->mTitle );
 134+ $error = $filter_result;
 135+
 136+ return $filter_result == '' || $filter_result === true;
 137+ }
124138 }