So... Inline with your comments, the sane thing to do would be to: - Wait for the fields in the database to be changed to BLOB for their usage. - Setup a config variable with an array of what character size to limit certain summaries. - Use that character size limit inside the HTML generation (The size= parameter of the XML:: function likely) rather than the hardcoded current one. - Call $wgContLang->trim(); to limit comments to a universal character count, rather than a byte count. - And in certain cases have the user re-sumbit with a new summary.
Now for my notes: - The re-submition for certain forms like the edit form should probably be done in a method similar to how other errors are treated. (We could probably actually just stick in a little extra code since we're already detecting blank edit summaries for users) - It would probably be best if we had a user preference (disabled by default) that would tell the server to just silently truncate their comments without warning them, because there are some users who may not want to need to resubmit the mass number of forms they need to submit all the time. - As for the generic function, it should be possible; -- We could make it another one of those error page generation functions inside of OutputPage:: and just call the function using $wgOut for it. -- The collection of form information should be possible by using $wgRequest->wasPosted() ? 'POST' : 'GET' to first generate the type of form. -- However, there is no current function to return an array of all the things that were passed, and using $_GET and $_POST is depreciated. We'd have to add a function for that into the WebRequest. Additionally it may be a good idea to separate logic on what is GET and what is POST as it's possible to GET a few of the values while POSTing the rest.
~Daniel Friesen(Dantman) of: -The Gaiapedia (http://gaia.wikia.com) -Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) -and Wiki-Tools.com (http://wiki-tools.com)
Brion Vibber wrote:
Simetrical wrote:
I was implementing a configuration option to allow changes to the maximum length of edit summaries and log reasons, which I've often felt are inadequate. In doing so, I discovered an issue that needs to be resolved before I proceed. Basically, when you type stuff in the form, the input box's maxlength parameter is a maximum number of *characters*. But when stuff gets validated and put in the database, it's generally a number of *bytes* that things are truncated to. I've verified that Firefox will actually permit 200 multibyte characters to be submitted as an edit summary, when they cannot possibly fit into the database field.
The current mix of limits between the HTML form field length and DB field length is known to not be an exact match; it's an approximate compromise.
There would however *be* no strict need to limit the summary length if the DB field is expanded -- going from VARCHAR or TINYBLOB out to BLOB will make pretty much arbitrarily large text possible.
If a limit is still desired, the most sensible thing would simply be to trim it at whatever huge number of characters you like. This can be done with the $wgContLang->trim() function on submission.
-- brion vibber (brion @ wikimedia.org)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l