Increase Post-content validation max-value
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Regarding the short discussion in https://discuss.flarum.org/d/29812-add-new-validator-to-core/6 i'd like to propose the increase of the `max`-value for the **Posts content validator** [src/Post/PostValidator.php](https://github.com/flarum/core/blob/master/src/Post/PostValidator.php).
The MySQL-database field type for `posts.content` was changed from `text` to `mediumtext`, which can contain up to 16777215 bytes of data, instead of the 65535 bytes for `text`.
As @clarkwinkelmann pointed out, the parsed XML of the TextFormatter XML format can be much bigger, then the content entered in the input field. That should be taken into account when increasing the value. But btw. that wasn't considered previously, when `text` matched the validator with 65535 bytes!
Germany wouldn't be Germany, without definig a [Norm-page](https://de.wikipedia.org/wiki/Normseite) wich contains approx. 1800 characters (including spaces). Which means you could roughly post about 36 pages worth of text (without formatting) with the current constraint of 65535 charachters.
While this is fine for the majority of posts, there are certain use-cases one could think of, which require more text. Like for example detailed analysis, essays or reviews or some scientific work or some extensively formatted content.
I don't have an exact `max`-value in mind, but if you take a quarter of 16777215 you come up with 4194304, which imho leaves enough room for anything TextFormatter could add.
This should not have any impact on the MySQL search performance. On the contrary. Wildcard-searching in one post should be more efficent then searching over multiple posts in the database - considering the same content (length) being searched.
If not increasing it in general, another option could be to have a select box with pre-defined values or a input-number field in the base settings of Flarum to determine the max value for each installation.
Contributor guide
Research direction
Start with src/Post/PostValidator.php and review the linked discussion about the Posts content validator. Compare the validator limit with the mediumtext capacity described in the issue, including TextFormatter's parsed XML expansion. Done means an agreed maximum is implemented and the validator behavior is covered or verified against the stated storage limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100