Page MenuHomePhabricator

importDump should emit a helpful message if some ContentHandler is missing
Open, LowPublic

Description

If you try to import a dump with (for example) Scribunto modules into a wiki that does not have Scribunto installed, you get "No handler for model 'Scribunto'' registered in $wgContentHandlers", followed by a big scary stack trace. We should catch that and emit something more useful, like a hint to go look for an appropriate extension.

Maybe we should create a MediaWiki.org mapping of ContentHandler types to their canonical implementation..


Version: 1.22.0
Severity: minor

Details

Reference
bz47270

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:40 AM
bzimport set Reference to bz47270.
bzimport added a subscriber: Unknown Object (MLST).
ori created this task.Apr 16 2013, 1:08 AM
ori added a comment.Apr 16 2013, 1:21 AM

(In reply to comment #0)

Maybe we should create a MediaWiki.org mapping of ContentHandler types to
their canonical implementation..

OK, started: http://www.mediawiki.org/wiki/Content_handlers

See also bug 47238

This bug still occurs here, while importing an XML file containing some 200000 (or something like that) pages. Is the only solution here installing Extension:Scribunto?

[a795deac] [no req] Exception from line 324 of [PATH]\in
cludes\content\ContentHandler.php: No handler for model 'Scribunto' registered i
n $wgContentHandlers
Backtrace:
#0 [PATH]\includes\content\ContentHandler.php(154): Conten
tHandler::getForModelID(string)
#1 [PATH]\includes\Import.php(1264): ContentHandler::makeC
ontent(string, Title, string, string)
#2 [PATH]\includes\Import.php(255): WikiRevision->getConte
nt()
#3 [internal function]: WikiImporter->importRevision(WikiRevision)
#4 [PATH]\maintenance\importDump.php(165): call_user_func(
array, WikiRevision)
#5 [internal function]: BackupReader->handleRevision(WikiRevision, WikiImporter)

#6 [PATH]\includes\Import.php(363): call_user_func_array(a
rray, array)
#7 [PATH]\includes\Import.php(718): WikiImporter->revision
Callback(WikiRevision)
#8 [PATH]\includes\Import.php(670): WikiImporter->processR
evision(array, array)
#9 [PATH]\includes\Import.php(621): WikiImporter->handleRe
vision(array)
#10 [PATH]\includes\Import.php(485): WikiImporter->handleP
age()
#11 [PATH]\maintenance\importDump.php(286): WikiImporter->
doImport()
#12 [PATH]\maintenance\importDump.php(253): BackupReader->
importFromHandle(resource)
#13 [PATH]\maintenance\importDump.php(97): BackupReader->i
mportFromStdin()
#14 [PATH]\maintenance\doMaintenance.php(104): BackupReade
r->execute()
#15 [PATH]\maintenance\importDump.php(291): require_once(s
tring)
#16 {main}

MediaWiki: 1.23.1
PHP: 5.5.9 (apache2handler)
MySQL: 5.6.16
XAMPP: v3.2.1, wiki not public available

Change 244871 had a related patch set uploaded (by TTO):
Improve error message for missing content model on import

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

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 10 2015, 8:45 AM
TTO added a subscriber: TTO.Oct 10 2015, 8:53 AM
@ori wrote:

you get "No handler for model 'Scribunto'' registered in $wgContentHandlers", followed by a big scary stack trace.

Can't do anything about the stack trace without a major overhaul of import code...

We should catch that and emit something more useful, like a hint to go look for an appropriate extension.

The above patch adds such a hint to the exception text, with a link to http://www.mediawiki.org/wiki/Content_handlers.

Is the only solution here installing Extension:Scribunto?

Yes. I don't know why you would import Scribunto modules onto your wiki unless you wanted to actually execute them. If you just want to store the text of the modules on your wiki, without executing them, you can alter the content model manually within the XML dump.

Change 244871 merged by jenkins-bot:
Improve error message for missing content model on import

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

saper added a subscriber: saper.Mar 2 2017, 1:17 AM

Just ran into this when importing some sample WMF wiki into my test one. I think the proper behaviour should be that data should be loaded, they may be not accessible or something.

Or, at the very least, the import should fail at the very beginning.

1leonkaden added a subscriber: 1leonkaden.EditedNov 1 2017, 6:15 AM

Yes. I don't know why you would import Scribunto modules onto your wiki unless you wanted to actually execute them

i got the same problem when i import none enlish wikipedia xml ( xml dump >1milion page or xml export few page)/
Problem is, in another language, module and template of mediawiki has been translated to another page name.
for example

.... Module:Taxxo on english Wiki now got Mô Đun:bảng phân loại on Vietnamese wiki.

Or Moduł:Wykres not Module:Wykres

This cause problem that we cant import xml ,that content Module Template that has been transltated, into mediawiki. Because Scribunto don't know what it is...

my question, and maybe solution fix for this problem is: How can we import a xml content Module has been translated to wiki, if Scribunto refuse to accepted it.
IS there any way that we can ignore Scribunto and then just import xml, which is content translated module, direct into Wiki ?

i've tried comment out Scribunto on localsetting.php, then import xml with DumpImport.php and Special:import but it can not be done.

Because this problem, many user, who try to import XML on a localhost mediawki or on some Wikipedia alternative cant not be done their job. Because without many template and module, we only got a wikipedia with 99% page error on infobox , note,

Please looking a serious fixing for this problem. Please dont set this topic to a low Priority case.