Page MenuHomePhabricator

Undefined index: id in includes/Import.php on line 549, clarify the XSD file
Closed, ResolvedPublic

Description

On line 127 of docs/export-0.5.xsd one sees
<element name="id" type="positiveInteger" minOccurs="0"/>
However omitting such items in an XML to be imported will cause
Notice: Undefined index: id in includes/Import.php on line 549
warnings, despite the minOccurs="0".

I recommend you document there in export-*.xsd, just exactly what
numbers you would like a person creating an XML file by hand for import to
use, if you insist on him giving such fields.

And mention what numbers are safe to use, and what numbers might
overwrite something with the same number, and if one is not to worry
about overwriting, then why can't he just not supply the various XML
<id> lines in the first place.

And even the Timestamp line. Mention why and if this is mandatory.

Same with all the other lines that might still make sense to be omitted when
handcrafting an XML file for import.


Version: 1.18.x
Severity: trivial

Details

Reference
bz28417

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:32 PM
bzimport set Reference to bz28417.

The xsd looks correct here; the error message looks like it's just some sloppy code.

Fixed on trunk (for 1.18) in r85362.

Be warned that the log import code may have similar issues if its input isn't validated properly.

Here's the usual scenario:
The user exports ten pages into one xml file.
Then he does s/bla bla/mla mla/ on the file.
Then he reimports it back in.
The he checks recentchanges to find most or all of his changes didn't
show up.
So then he tinkers with the <timestamp>s, and reimports again. Maybe
it will work this time.
What he really wants is an explicit statement there offline saying
just what <id> etc. he can remove, or why and what timestamp
adjustment he needs, to get his import imported. Its all undocumented
black magic currently.

As previpusly mentioned, id is not required. The xsd is correct, and the sloppy code is fixed on trunk. Is there any other specific documentation that needs fixing?

Why is timestamp required upon import? Why can't the system choose it
for us like it can the id?