Page MenuHomePhabricator

Special:Import doesn't respect $wgMaxArticleSize
Closed, ResolvedPublic

Description

Example XML

  1. Set $wgMaxArticleSize to 1024
  2. Import the attached XML (it's [[User:Moudy83/conference_papers]])

Expected result: the page is rejected, because it's 1500 KB.

Actual results:

http://wikipapers.referata.com/w/index.php?title=Special:Import&action=submit

Importazione delle pagine in corso...

    User:Moudy83/conference papers 6 revisioni importate

Importazione non riuscita: Content of User:Moudy83/conference_papers is not valid! Content model is wikitext

http://wikipapers.referata.com/wiki/User:Moudy83/conference_papers

Fatal error: Call to undefined method stdClass::getRedirectChain() in /home/yaron57/public_html/w/includes/Article.php on line 691

Context

Before setting $wgMaxArticleSize, saving in action=edit was possible but resulted in a DB error:

Funzione: Revision::insertOn
Errore: 1153 Got a packet bigger than 'max_allowed_packet' bytes (localhost)

After setting the variable, the edit is correctly rejected, unless I reduce it below the limit: http://wikipapers.referata.com/w/index.php?title=User:Moudy83/conference_papers2&oldid=24717


Version: unspecified
Severity: normal

Attached:

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:52 AM
bzimport set Reference to bz71230.
bzimport added a subscriber: Unknown Object (MLST).

Should it, though? I guess it depends what the purpose of $wgMaxArticleSize is.

According to the docs, one use for $wgMaxArticleSize is if your post-expand include size is too large. In that case, it makes (limited) sense for imports to honor the setting.

In T73230#1730381, @TTO wrote:

Should it, though? I guess it depends what the purpose of $wgMaxArticleSize is.

Sometimes $wgMaxArticleSize is set to prevent MediaWiki from storing text larger than the database is configured to handle.
Ignoring the setting results into 1153 Got a packet bigger than 'max_allowed_packet' bytes (localhost) on the mentioned wiki.

This comment was removed by TTO.

In normal logic, $wgMaxArticleSize is checked in the quagmire that is EditPage.php. This means that only content models that use the classic action=edit model (whether via the API or via the UI) will be checked against $wgMaxArticleSize.

So in Import, I think we should only check the size of the revision where the content model is empty/null, or one of wikitext, css, json, javascript, text. If the content model is set to something else, like flow-board, we should not check the size.

Nemo_bis set Security to None.

Change 260618 had a related patch set uploaded (by Georggi199):
Import: Importing no longer accepts too big revisions

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

Change 260618 merged by jenkins-bot:
Import: Importing no longer accepts too big revisions

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