If session data is lost between the transactions (read: the csrf token
does not match), the error message contains some wiki markup as well as
HTML. However, unfortunately, SpecialImport uses $out->wrapWikiMsg() in
combination with an error message (with wiki markup and HTML) wrapped as
a parameter of another message. This results in an escaped paramater and
it is not parsed correctly, which leads in wiki markup send to the user.
This change fixes that issue by parsing the message directly.
Bug: T172114
Change-Id: If49a600173c44d098f25d6e2a9b87b7b7bf3ee2a
$out = $this->getOutput();
if ( !$source->isGood() ) {
$out = $this->getOutput();
if ( !$source->isGood() ) {
- $out->wrapWikiMsg(
- "<p class=\"error\">\n$1\n</p>",
- [ 'importfailed', $source->getWikiText() ]
- );
+ $out->addWikiText( "<p class=\"error\">\n" .
+ $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</p>" );
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !is_null( $this->namespace ) ) {
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !is_null( $this->namespace ) ) {
"import-nonewrevisions": "No revisions imported (all were either already present, or skipped due to errors).",
"xml-error-string": "$1 at line $2, col $3 (byte $4): $5",
"import-upload": "Upload XML data",
"import-nonewrevisions": "No revisions imported (all were either already present, or skipped due to errors).",
"xml-error-string": "$1 at line $2, col $3 (byte $4): $5",
"import-upload": "Upload XML data",
- "import-token-mismatch": "Loss of session data.\n\nYou might have been logged out. <strong>Please verify that you're still logged in and try again</strong>.\nIf it still does not work, try [[Special:UserLogout|logging out]] and logging back in, and check that your browser allows cookies from this site.",
+ "import-token-mismatch": "Loss of session data.\n\nYou might have been logged out. '''Please verify that you're still logged in and try again'''.\nIf it still does not work, try [[Special:UserLogout|logging out]] and logging back in, and check that your browser allows cookies from this site.",
"import-invalid-interwiki": "Cannot import from the specified wiki.",
"import-error-edit": "Page \"$1\" was not imported because you are not allowed to edit it.",
"import-error-create": "Page \"$1\" was not imported because you are not allowed to create it.",
"import-invalid-interwiki": "Cannot import from the specified wiki.",
"import-error-edit": "Page \"$1\" was not imported because you are not allowed to edit it.",
"import-error-create": "Page \"$1\" was not imported because you are not allowed to create it.",