Import repository object export file.
182 : array {
183 if ($a_component == "") {
184 $a_component = ilImportExportFactory::getComponentForExport($a_type);
185 }
186 $this->comp = $a_component;
187
188
189 $success = true;
190
191
192 if (!is_file($dir . "/manifest.xml")) {
193 $mess = (DEVMODE)
194 ? 'Manifest file not found: "' . $dir . "/manifest.xml" . '".'
195 : 'Manifest file not found: "manifest.xml."';
197 $e->setManifestDir($dir);
198 $e->setTmpDir($a_tmpdir);
200 }
202 $this->mapping->setInstallUrl($parser->getInstallUrl());
203 $this->mapping->setInstallId($parser->getInstallId());
204
205
206 if ($parser->getMainEntity() != $a_type) {
208 "Object type does not match. Import file has type '" .
209 $parser->getMainEntity() . "' but import being processed for '" . $a_type . "'."
210 );
211 }
212
213
214 $expfiles = $parser->getExportFiles();
215
216 $all_importers = array();
217 foreach ($expfiles as $expfile) {
218 $comp = $expfile[
"component"];
219
220 if (isset($this->skip_importer[
$comp]) && $this->skip_importer[
$comp] ===
true) {
221 continue;
222 }
223
224 $class = ilImportExportFactory::getImporterClass(
$comp);
225
226
227
228
229 if ($class == '') {
230 $this->log->warning("no class found for component: $comp");
231 continue;
232 }
233
234 $this->log->debug("create new class = $class");
235
236 $this->importer = new $class();
237 $this->importer->setImport($this);
240 $this->importer->init();
241 $this->current_comp =
$comp;
242 try {
243 $this->log->debug("Process file: " . $dir . "/" . $expfile["path"]);
244 $parser =
new ilExportFileParser($dir .
"/" . $expfile[
"path"], $this,
"processItemXml");
245 }
catch (Exception
$e) {
246 $this->log->error(
"Import failed: " .
$e->getMessage());
247 $this->log->error('XML failed: ' . file_get_contents($dir . '/' . $expfile['path']));
249 }
250 }
251
252
253 $obj_map = $this->
getMapping()->getMappingsOfEntity(
'Services/Container',
'objs');
254 if (is_array($obj_map)) {
255 foreach ($obj_map as $obj_id_old => $obj_id_new) {
257 (int) $obj_id_new,
258 "il_" . $this->mapping->getInstallId() .
"_" .
ilObject::_lookupType((
int) $obj_id_new) .
"_" . $obj_id_old
259 );
260 }
261 }
262
263
264 foreach ($all_importers as $imp) {
265 $this->log->debug("Call finalProcessing for: " . get_class($imp));
266 $imp->finalProcessing($this->mapping);
267 }
268
269
270 $top_mapping = $this->mapping->getMappingsOfEntity($this->comp, $a_type);
271
272 $new_id = (
int) current($top_mapping);
273 return array(
274 'new_id' => $new_id,
275 'importers' => $all_importers
276 );
277 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Manifest parser for ILIAS standard export files.
static _lookupType(int $id, bool $reference=false)
static _writeImportId(int $obj_id, string $import_id)
write import id to db (static)
setImportDirectory(string $a_val)