Add $wgHideUserContribLimit config setting
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 17 Dec 2013 18:56:33 +0000 (19:56 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 18 Jan 2014 19:33:50 +0000 (19:33 +0000)
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

includes/DefaultSettings.php
includes/specials/SpecialBlock.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php

index 69d4633..31cbb4c 100644 (file)
@@ -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.
  *
index 1aa8006..3780660 100644 (file)
  * @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' );
                        }
index 11e2597..726b8f0 100644 (file)
@@ -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}}',
index dc7a9ec..538eed5 100644 (file)
@@ -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',