* Maintenance script to wipe a page and all revisions from the database
* Maintenance script to reassign edits from one user to another
* Maintenance script to find and remove links to a given domain (cleanupSpam.php)
+* Fix --report interval option for dumpTextPass
i18n / Languages:
* Partial support for Basque language (from wikipedia and meta)
* Fix explicit s-maxage=0 on raw pages; should help with proxy issues in
generated stylesheets... hopefully...
* (bug 4685) More fixes for Slovenian project namespace
-* Fix --report interval option for dumpTextPass
* Fixed and enhanced a little the Live Preview, which had been broken for some time
+* Added article size limit, $wgMaxArticleSize
=== Caveats ===
var $firsttime;
var $lastDelete;
var $mTokenOk = true;
+ var $tooBig = false;
+ var $kblength = false;
# Form values
var $save = false, $preview = false, $diff = false;
*/
function attemptSave() {
global $wgSpamRegex, $wgFilterCallback, $wgUser, $wgOut;
+ global $wgMaxArticleSize;
$fname = 'EditPage::attemptSave';
wfProfileIn( $fname );
wfProfileOut( $fname );
return false;
}
-
+ $this->kblength = (int)(strlen( $this->textbox1 ) / 1024);
+ if ( $this->kblength > $wgMaxArticleSize ) {
+ // Error will be displayed by showEditForm()
+ $this->tooBig = true;
+ wfProfileOut( "$fname-checks" );
+ wfProfileOut( $fname );
+ return true;
+ }
+
if ( !$wgUser->isAllowed('edit') ) {
if ( $wgUser->isAnon() ) {
$this->userNotLoggedInPage();
$this->textbox1 = $text;
$this->section = '';
+ // Check for length errors again now that the section is merged in
+ $this->kblength = (int)(strlen( $text ) / 1024);
+ if ( $this->kblength > $wgMaxArticleSize ) {
+ $this->tooBig = true;
+ wfProfileOut( $fname );
+ return true;
+ }
+
# update the article here
if( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
$this->watchthis, '', $sectionanchor ) ) {
* near the top, for captchas and the like.
*/
function showEditForm( $formCallback=null ) {
- global $wgOut, $wgUser, $wgLang, $wgContLang;
+ global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize;
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
}
$wgOut->addWikiText( $notice );
}
-
- $kblength = (int)(strlen( $this->textbox1 ) / 1024);
- if( $kblength > 29 ) {
- $wgOut->addWikiText( wfMsg( 'longpagewarning', $wgLang->formatNum( $kblength ) ) );
+
+ if ( $this->kblength === false ) {
+ $this->kblength = (int)(strlen( $this->textbox1 ) / 1024);
+ }
+ if ( $this->tooBig || $this->kblength > $wgMaxArticleSize ) {
+ $wgOut->addWikiText( wfMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgMaxArticleSize ) );
+ } elseif( $this->kblength > 29 ) {
+ $wgOut->addWikiText( wfMsg( 'longpagewarning', $wgLang->formatNum( $this->kblength ) ) );
}
$rows = $wgUser->getOption( 'rows' );
'longpagewarning' => "<strong>WARNING: This page is $1 kilobytes long; some
browsers may have problems editing pages approaching or longer than 32kb.
Please consider breaking the page into smaller sections.</strong>",
+'longpageerror' => "<strong>ERROR: The text you have submitted is $1 kilobytes
+long, which is longer than the maximum of $2 kilobytes. It cannot be saved.</strong>",
'readonlywarning' => '<strong>WARNING: The database has been locked for maintenance,
so you will not be able to save your edits right now. You may wish to cut-n-paste
the text into a text file and save it for later.</strong>',