Page MenuHomePhabricator

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


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:

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

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


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:

Version: unspecified
Severity: normal


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).
TTO added a subscriber: TTO.Oct 16 2015, 10:59 AM

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.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 16 2015, 10:59 AM
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.
TTO assigned this task to Georggi199.Dec 22 2015, 6:12 AM

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 updated the task description. (Show Details)Dec 22 2015, 9:26 AM
Nemo_bis set Security to None.

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

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

TTO closed this task as Resolved.Dec 23 2015, 9:42 AM