jenkins-bot has submitted this change and it was merged.

Change subject: Add $wgHideUserContribLimit config setting
......................................................................


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
---
M includes/DefaultSettings.php
M includes/specials/SpecialBlock.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
4 files changed, 18 insertions(+), 9 deletions(-)

Approvals:
  Parent5446: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 69d4633..31cbb4c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4556,6 +4556,15 @@
 $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.
  *
  * @warning Requires memcached
diff --git a/includes/specials/SpecialBlock.php 
b/includes/specials/SpecialBlock.php
index 1aa8006..3780660 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 @@
         * @return Bool|String
         */
        public static function processForm( array $data, IContextSource 
$context ) {
-               global $wgBlockAllowsUTEdit;
+               global $wgBlockAllowsUTEdit, $wgHideUserContribLimit;
 
                $performer = $context->getUser();
 
@@ -673,10 +669,13 @@
                        } 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 11e2597..726b8f0 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -3376,7 +3376,7 @@
 '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 dc7a9ec..538eed5 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -6596,7 +6596,8 @@
 * {{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',

-- 
To view, visit https://gerrit.wikimedia.org/r/98267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3fd39c1c9dfa65a24a3451800dc623b40162aeb5
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Happy-melon <happy.melon.w...@gmail.com>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to