xml import: check schema-version
This commit is contained in:
parent
7acc194b53
commit
a679752aaa
1 changed files with 16 additions and 0 deletions
|
@ -5127,6 +5127,22 @@
|
||||||
if ($doc) {
|
if ($doc) {
|
||||||
|
|
||||||
$xpath = new DOMXpath($doc);
|
$xpath = new DOMXpath($doc);
|
||||||
|
|
||||||
|
$container = $doc->firstChild;
|
||||||
|
|
||||||
|
if ($container && $container->hasAttribute('schema-version')) {
|
||||||
|
$schema_version = $container->getAttribute('schema-version');
|
||||||
|
|
||||||
|
if ($schema_version != SCHEMA_VERSION) {
|
||||||
|
print "<p>" .__("Could not import: incorrect schema version.") . "</p>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p>" . __("Could not import: unrecognized document format.") . "</p>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$articles = $xpath->query("//article");
|
$articles = $xpath->query("//article");
|
||||||
|
|
||||||
foreach ($articles as $article_node) {
|
foreach ($articles as $article_node) {
|
||||||
|
|
Loading…
Reference in a new issue