Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/211332

Change subject: Expand maximum post length to be based on $wgMaxArticleSize
......................................................................

Expand maximum post length to be based on $wgMaxArticleSize

It's not the same exact limit as $wgMaxArticleSize because ours
is a character limit whereas that is a byte limit.

Bug: T95978
Change-Id: I50d93478b8413296389268e50ca5e9aa39c45dd1
---
M container.php
M includes/Model/PostRevision.php
M includes/SpamFilter/ContentLengthFilter.php
3 files changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/32/211332/1

diff --git a/container.php b/container.php
index d08bf15..c113647 100644
--- a/container.php
+++ b/container.php
@@ -804,7 +804,14 @@
 };
 
 $c['controller.contentlength'] = function( $c ) {
-       return new Flow\SpamFilter\ContentLengthFilter;
+       global $wgMaxArticleSize;
+
+       // wgMaxArticleSize is in kilobytes,
+       // whereas this really is characters (it uses
+       // mb_strlen), so it's not the exact same limit.
+       $maxCharCount = $wgMaxArticleSize * 1024;
+
+       return new Flow\SpamFilter\ContentLengthFilter( $maxCharCount );
 };
 
 $c['controller.spamfilter'] = function( $c ) {
diff --git a/includes/Model/PostRevision.php b/includes/Model/PostRevision.php
index 2f2411e..a901844 100644
--- a/includes/Model/PostRevision.php
+++ b/includes/Model/PostRevision.php
@@ -12,7 +12,6 @@
 
 class PostRevision extends AbstractRevision {
        const MAX_TOPIC_LENGTH = 260;
-       const MAX_POST_LENGTH = 25600;
 
        /**
         * @var UUID
diff --git a/includes/SpamFilter/ContentLengthFilter.php 
b/includes/SpamFilter/ContentLengthFilter.php
index b8cb270..33ea50b 100644
--- a/includes/SpamFilter/ContentLengthFilter.php
+++ b/includes/SpamFilter/ContentLengthFilter.php
@@ -14,7 +14,7 @@
         */
        protected $maxLength;
 
-       public function __construct( $maxLength = 25600 ) {
+       public function __construct( $maxLength ) {
                $this->maxLength = $maxLength;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50d93478b8413296389268e50ca5e9aa39c45dd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

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

Reply via email to