Last modified: 2014-07-14 13:58:13 UTC
The hooks ImportHandleLogItemXMLTag[1], ImportHandlePageXMLTag[2], ImportHandleUploadXMLTag[3] and ImportHandleToplevelXMLTag[4] provide a WikiImporter object as parameter instead of a XMLReader object as the documentation asserts. Therefore there is currently no way to access the name of the tag currently being processed or the contents of the tag being processed. [1] http://www.mediawiki.org/wiki/Manual:Hooks/ImportHandleLogItemXMLTag [2] http://www.mediawiki.org/wiki/Manual:Hooks/ImportHandlePageXMLTag [3] http://www.mediawiki.org/wiki/Manual:Hooks/ImportHandleUploadXMLTag [4] http://www.mediawiki.org/wiki/Manual:Hooks/ImportHandleToplevelXMLTag
Hey, I have written a small patch for this bug. You can review it here: https://gerrit.wikimedia.org/r/#/c/133064/1
Perhaps the better solution would be to fix the documentation and give Import a method for getting the reader (or adding the desired extra info to the info arrays passed to the hooks). It seems useful for the hook functions to have access to things like Import::warn, so they can trigger warnings.
I agree with you. I have now added a getter method for the XMLReader and change the visibility of some functions (e.g. Import::warn) for use in hooks. https://gerrit.wikimedia.org/r/#/c/133064/