Last modified: 2013-07-24 15:32:53 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T53504, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51504 - Import failed: Format text/plain is not supported for content model Scribunto
Import failed: Format text/plain is not supported for content model Scribunto
Status: RESOLVED DUPLICATE of bug 45750
Product: MediaWiki
Classification: Unclassified
Export/Import (Other open bugs)
1.22.0
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-17 03:49 UTC by dan
Modified: 2013-07-24 15:32 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description dan 2013-07-17 03:49:40 UTC
some templates on commons, e.g., Template:Institution, include modules that use lua scripting. exporting those templates and then importing them into another wiki causes an error - “Import failed: Format text/plain is not supported for content model Scribunto error”.

in LocalSettings.php
--------------------
require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
require_once("$IP/extensions/Scribunto/Scribunto.php");
$wgScribuntoDefaultEngine = 'luastandalone';
$wgScribuntoUseGeSHi = true;
$wgScribuntoUseCodeEditor = true;
require_once("$IP/extensions/TemplateSandbox/TemplateSandbox.php");

$wgExtraNamespaces[828] = 'Module';
$wgExtraNamespaces[829] = 'Module_talk';


steps to reproduce
------------------
1. go to http://commons.wikimedia.org/wiki/Special:Export
2. export the Template:Institution
   √ Include only the current revision, not the full history
   √ Include templates
   √ Save as file
3. go to local wiki http://mywiki/wiki/Special:Import
4. select the file saved in step 2.


results
-------
1. all templates import without issue
2. Import failed: Format text/plain is not supported for content model Scribunto
3. outdated history link gets created for the module page, e.g., http://mywiki/wiki/Module:Languages - The revision #0 of the page named "Languages" does not exist. This is usually caused by following an outdated history link to a page that has been deleted. Details can be found in the deletion log.


expected results
----------------
1. all templates import without issue
2. all modules import without issue


current method for avoiding the issue
-------------------------------------
1. in the exported xml file remove any Module pages
2. create the Module pages manually
3. import using the modified export file
Comment 1 Brad Jorsch 2013-07-17 16:07:27 UTC
Another method to avoid the issue is to replace "<format>text/plain</format>" in the dump with whatever format your wiki is expecting.

You could also upgrade Scribunto on your wiki to a version that includes Gerrit change #61468.

*** This bug has been marked as a duplicate of bug 45750 ***
Comment 2 dan 2013-07-17 22:18:00 UTC
(In reply to comment #1)
thanks brad,

i can confirm that the Gerrit change #61468 took care of this issue. regarding the change to "<format>text/plain</format>", how would i find out what format the wiki is expecting?
Comment 3 Brad Jorsch 2013-07-17 22:44:02 UTC
(In reply to comment #2)
> regarding
> the change to "<format>text/plain</format>", how would i find out what format
> the wiki is expecting?

One way would be to export a module page from your wiki and see what format it says.

Or you could ask the API, something like https://en.wikipedia.org/w/api.php?format=jsonfm&action=query&prop=revisions&rvprop=content&titles=Module:Bananas
Comment 4 dan 2013-07-18 00:59:19 UTC
(In reply to comment #3)
the format of the modules in the export of Template:Institution is <format>text/plain</format>, so there’s no change to <format> in that case that would help, it still fails without applying the Gerrit change you mentioned.

in that Gerrit change, is the isSupportedFormat method necessary? i was able to apply the change to the constructor only - $formats = array( 'CONTENT_FORMAT_TEXT' ) to $formats = array( CONTENT_FORMAT_TEXT ) and that took care of the issue; i didn’t need to add the isSupportedFormat method.
Comment 5 Brad Jorsch 2013-07-18 01:44:12 UTC
(In reply to comment #4)
> (In reply to comment #3)
> the format of the modules in the export of Template:Institution is
> <format>text/plain</format>, so there’s no change to <format> in that case
> that

You misunderstood me, I think. What do you get if you export a module page from "mywiki"? Or more correctly, what did you get before applying the patch that let you import?

> in that Gerrit change, is the isSupportedFormat method necessary? i was able
> to
> apply the change to the constructor only - $formats = array(
> 'CONTENT_FORMAT_TEXT' ) to $formats = array( CONTENT_FORMAT_TEXT ) and that
> took care of the issue; i didn’t need to add the isSupportedFormat method.

IIRC, it makes existing module pages continue to work if you have $wgContentHandlerUseDB set to true (which is the default).
Comment 6 dan 2013-07-24 15:32:53 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > the format of the modules in the export of Template:Institution is
> > <format>text/plain</format>, so there’s no change to <format> in that case
> > that
> 
> You misunderstood me, I think. What do you get if you export a module page
> from
> "mywiki"? Or more correctly, what did you get before applying the patch that
> let you import?

yes, i misunderstood what you meant by what do i get when i export the module. when i export Module:Date from my local dev wiki without the patch, i get <format>CONTENT_FORMAT_TEXT</format>. with just the change to the __construct method i get <format>text/plain</format>.

in any case, it looks like the latest version of Scribunto contains the patch including the isSupportedFormat method and everything works fine with that so i’m glad to see that. thanks for your continued follow-up.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links