From: umherirrender Date: Tue, 17 Dec 2013 18:56:33 +0000 (+0100) Subject: Add $wgHideUserContribLimit config setting X-Git-Tag: 1.31.0-rc.0~17214^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=8616f1b97023818b32012608746d5adcda181394;p=lhc%2Fweb%2Fwiklou.git Add $wgHideUserContribLimit config setting Replace const in Special:Block by a config setting in DefaultSettings.php Setting to false will disable the limit (instead of setting to a very high number). The value is unchanged, but now it is possible to change it in LocalSettings.php Also add the value to the message to give better feedback to the performer of the action. Change-Id: I3fd39c1c9dfa65a24a3451800dc623b40162aeb5 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 69d4633c92..31cbb4c10c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4555,6 +4555,15 @@ $wgAvailableRights = array(); */ $wgDeleteRevisionsLimit = 0; +/** + * The maximum number of edits a user can have and + * can still be hidden by users with the hideuser permission. + * This is limited for performance reason. + * Set to false to disable the limit. + * @since 1.23 + */ +$wgHideUserContribLimit = 1000; + /** * Number of accounts each IP address may create, 0 to disable. * diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 1aa800690a..3780660704 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -28,10 +28,6 @@ * @ingroup SpecialPage */ class SpecialBlock extends FormSpecialPage { - /** The maximum number of edits a user can have and still be hidden - * TODO: config setting? */ - const HIDEUSER_CONTRIBLIMIT = 1000; - /** @var User user to be blocked, as passed either by parameter (url?wpTarget=Foo) * or as subpage (Special:Block/Foo) */ protected $target; @@ -602,7 +598,7 @@ class SpecialBlock extends FormSpecialPage { * @return Bool|String */ public static function processForm( array $data, IContextSource $context ) { - global $wgBlockAllowsUTEdit; + global $wgBlockAllowsUTEdit, $wgHideUserContribLimit; $performer = $context->getUser(); @@ -673,10 +669,13 @@ class SpecialBlock extends FormSpecialPage { } elseif ( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) { # Bad expiry. return array( 'ipb_expiry_temp' ); - } elseif ( $user->getEditCount() > self::HIDEUSER_CONTRIBLIMIT ) { + } elseif ( $wgHideUserContribLimit !== false + && $user->getEditCount() > $wgHideUserContribLimit + ) { # Typically, the user should have a handful of edits. # Disallow hiding users with many edits for performance. - return array( 'ipb_hide_invalid' ); + return array( array( 'ipb_hide_invalid', + Message::numParam( $wgHideUserContribLimit ) ) ); } elseif ( !$data['Confirm'] ) { return array( 'ipb-confirmhideuser', 'ipb-confirmaction' ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 11e259798d..726b8f053c 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -3376,7 +3376,7 @@ See the [[Special:BlockList|block list]] for the list of currently operational b 'range_block_disabled' => 'The administrator ability to create range blocks is disabled.', 'ipb_expiry_invalid' => 'Expiry time invalid.', 'ipb_expiry_temp' => 'Hidden username blocks must be permanent.', -'ipb_hide_invalid' => 'Unable to suppress this account; it may have too many edits.', +'ipb_hide_invalid' => 'Unable to suppress this account; it has more than {{PLURAL:$1|one edit|$1 edits}}.', 'ipb_already_blocked' => '"$1" is already blocked.', 'ipb-needreblock' => '$1 is already blocked. Do you want to change the settings?', 'ipb-otherblocks-header' => 'Other {{PLURAL:$1|block|blocks}}', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index dc7a9ec8a1..538eed5b5f 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -6596,7 +6596,8 @@ See also: * {{msg-mw|Ip range toolarge}}', 'ipb_expiry_invalid' => 'Used as error message in [[Special:Block]].', 'ipb_expiry_temp' => 'Warning message displayed on [[Special:BlockIP]] if the option "hide username" is selected but the expiry time is not infinite.', -'ipb_hide_invalid' => 'Used as error message in [[Special:Block]].', +'ipb_hide_invalid' => 'Used as error message in [[Special:Block]]. +* $1 - Number of edits (Value of [[mw:Manual:$wgHideUserContribLimit]])', 'ipb_already_blocked' => '{{Identical|$1 is already blocked}}', 'ipb-needreblock' => 'Used in [[Special:Block]]. * $1 - target username',