Skip to content

Commit

Permalink
Fixes schema search in ilImport, schema sub_types are now recognized …
Browse files Browse the repository at this point in the history
…properly
  • Loading branch information
chlulei committed Oct 19, 2023
1 parent b0a00f1 commit c82e7c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function loadDomDocument(): DOMDocument
$this->status->handler()->withType(StatusType::FAILED)->withContent(
$this->status->content()->builder()->string()->withString(
"Error loading dom document:" .
"<br>" . $this->getFilePath() .
"<br>" . $error->message
"<br> XML: " . $this->getSubPathToDirBeginningAtPathEnd('temp') .
"<br>ERROR: " . $error->message
)
)
);
Expand Down
15 changes: 10 additions & 5 deletions Services/Export/classes/class.ilImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,19 @@ protected function validateXMLFiles(SplFileInfo $manifest_spl): ilImportStatusHa
->withFileHandler($export_file)
->getNodeInfoAt($path_to_export)
->current();
$entity_type = $export_node_info->getValueOfAttribute('Entity');
// type = one_two splitten
$latest_file_info = $schema_factory->getLatest($entity_type);
$types_str = $export_node_info->getValueOfAttribute('Entity');
$types = (str_contains($types_str, '_'))
? explode('_', $types_str)
: [$types_str];
$latest_file_info = count($types) === 1
? $schema_factory->getLatest($types[0])
: $schema_factory->getLatest($types[0], $types[1]);
$this->log->dump($types);
if (is_null($latest_file_info)) {
$status_collection = $status_collection->withAddedStatus($this->import_status->handler()
->withType(StatusType::DEBUG)
->withContent($this->import_status->content()->builder()->string()->withString(
'Missing schema xsd file for entity of type: ' . $entity_type
'Missing schema xsd file for entity of type: ' . implode('_', $types)
)));
continue;
}
Expand All @@ -250,7 +255,7 @@ protected function checkStatus(ilImportStatusHandlerCollectionInterface $import_
if ($import_status_collection->hasStatusType(StatusType::FAILED)) {
throw new ilImportException($import_status_collection
->withNumberingEnabled(true)
->toString(StatusType::FAILED));
->toString(StatusType::FAILED, StatusType::DEBUG));
}
}

Expand Down

0 comments on commit c82e7c6

Please sign in to comment.