Page MenuHomePhabricator

Allow setting target namespace in importDump.php
Open, Needs TriagePublic

Description

Special:Import allows pages to be placed into a selected namespace.
This functionality is not present in importDump.php.

My reason for needing this is importing Wikidata items from namespace 0 into a custom Item: namespace.

Note that this is not required to import Wikidata properties from namespace 120 to a different namespace number if the namespace name is "Property".

Event Timeline

jayvdb created this task.Aug 23 2016, 2:44 PM
Restricted Application added subscribers: TTO, Aklapper. · View Herald TranscriptAug 23 2016, 2:44 PM

Change 306219 had a related patch set uploaded (by John Vandenberg):
Allow importing to specified namespace

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

The attached patch in gerrit has the problem that a dump with pages in multiple namespaces needs to be processed multiple times -- once for each source namespace that is mapped to a different target namespace. i.e.

  1. --namespaces=0 --to-namespace=$WB_NS_DATA, then
  2. --namespaces= --to-namespace=$WB_NS_DATA_TALK` , and then
  3. --namespaces=1|2|3|4|5|6|7|8|9|10|11|12|13|14|15 for unchanged namespaces

Another approach, which will require more development work, is to map XML source namespaces to the target wiki namespaces. i.e. the command line equivalent of T43969 , allowing that task to focus on the UI aspects.

This could be done with the --namespaces argument, which is currently only an inclusive filter for the namespaces to import, but it could be expanded to optionally specify the target namespace for each namespace included. e.g.

--namespaces=0:120|1:121|2|3|...

or

--namespaces=0:120|1:121|all

Some validation of the target namespaces will be needed (or at least useful), so it might be useful to solve T64111 first.

jayvdb updated the task description. (Show Details)Aug 25 2016, 1:38 AM
Paladox added a subscriber: Paladox.Apr 8 2020, 6:00 PM