r51413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51412‎ | r51413 | r51414 >
Date:15:52, 3 June 2009
Author:werdna
Status:ok
Tags:
Comment:
(bug 18659) Allow setting AbuseFilter block duration with $wgAbuseFilterBlockDuration
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -119,3 +119,5 @@
120120 $wgAbuseFilterCentralDB = null;
121121 $wgAbuseFilterIsCentral = false;
122122
 123+// Block duration
 124+$wgAbuseFilterBlockDuration = 'indefinite';
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -925,7 +925,7 @@
926926 break;
927927
928928 case 'block':
929 - global $wgUser;
 929+ global $wgUser, $wgAbuseFilterBlockDuration;
930930 $filterUser = AbuseFilter::getFilterUser();
931931
932932 // Create a block.
@@ -938,14 +938,18 @@
939939 $block->mTimestamp = wfTimestampNow();
940940 $block->mAnonOnly = 1;
941941 $block->mCreateAccount = 1;
942 - $block->mExpiry = 'infinity';
 942+ $block->mExpiry = Block::parseExpiryInput( $wgAbuseFilterBlockDuration );
943943
944944 $block->insert();
945945
946946 // Log it
947947 # Prepare log parameters
948948 $logParams = array();
949 - $logParams[] = 'indefinite';
 949+ if ($block->mExpiry == 'infinity') {
 950+ $logParams[] = 'indefinite';
 951+ } else {
 952+ $logParams[] = $wgAbuseFilterBlockDuration;
 953+ }
950954 $logParams[] = 'nocreate, angry-autoblock';
951955
952956 $log = new LogPage( 'block' );

Status & tagging log