ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExport Class Reference

Export. More...

+ Inheritance diagram for ilExport:
+ Collaboration diagram for ilExport:

Public Member Functions

 __construct ()
 
 setPathInfo (ExportPathInfoInterface $export_path_info)
 
 getExportDirInContainer ()
 
 getPathToComponentExpDirInContainer ()
 
 getPathToComponentExpDirInContainerWithLeadingSetNumber ()
 
 getSetNumber ()
 
 isContainerExport ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 setExportWriter (ilExportHandlerConsumerExportWriterInterface $export_writer,)
 
 getExportWriter ()
 
 setExportConfigs (ExportConfigCollectionInterface $export_configs)
 
 getExportConfigs ()
 
 exportObject (string $a_type, int $a_id, string $a_target_release="")
 @depricated Export an ILIAS object (the object type must be known by objDefinition) More...
 
 exportEntity (string $a_entity, string $a_id, string $a_target_release, string $a_component, string $a_title, string $a_export_dir, string $a_type_for_file="")
 @depricated Export an ILIAS entity More...
 
 processExporter (string $a_comp, string $a_class, string $a_entity, string $a_target_release, ?array $a_id=null)
 @depricated Process exporter More...
 

Static Public Member Functions

static _getValidExportSubItems (int $a_ref_id)
 Get a list of subitems of a repository resource, that implement the export. More...
 
static _getLastExportFileDate (int $a_obj_id, string $a_type="", string $a_obj_type="")
 @depricated Get date of last export file More...
 
static _getLastExportFileInformation (int $a_obj_id, string $a_type="", string $a_obj_type="")
 @depricated Get last export file information More...
 
static _getExportDirectory (int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
 @depricated Get export directory for an repository object More...
 
static _getExportFiles (int $a_obj_id, $a_export_types="", string $a_obj_type="")
 @depricated More...
 
static _createExportDirectory (int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
 
static _generateIndexFile (string $a_filename, int $a_obj_id, array $a_files, string $a_type="")
 @depricated Generates an index.html file including links to all xml files included (for container exports) More...
 

Data Fields

string $export_run_dir = ''
 

Static Protected Member Functions

static createPathFromId (int $a_container_id, string $a_name)
 

Protected Attributes

string $dir_relative = ""
 
string $dir_absolute = ""
 
ilLogger $log
 
ilExportHandlerConsumerExportWriterInterface $export_writer
 
ExportPathInfoInterface $export_path_info
 
ExportConfigCollectionInterface $export_configs
 

Private Attributes

array $cnt = []
 
ilXmlWriter $manifest_writer = null
 

Static Private Attributes

static array $new_file_structure
 
static array $export_implementer = array("tst", "lm", "glo", "sahs")
 

Detailed Description

Export.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 30 of file class.ilExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilExport::__construct ( )

Definition at line 56 of file class.ilExport.php.

57 {
58 global $DIC;
59 $this->log = $DIC->logger()->exp();
60 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ _createExportDirectory()

static ilExport::_createExportDirectory ( int  $a_obj_id,
string  $a_export_type = "xml",
string  $a_obj_type = "" 
)
static

Definition at line 318 of file class.ilExport.php.

322 : bool {
323 global $DIC;
324
325 $ilErr = $DIC['ilErr'];
326
327 if ($a_obj_type == "") {
328 $a_obj_type = ilObject::_lookupType($a_obj_id);
329 }
330
331 $edir = ilExport::_getExportDirectory($a_obj_id, $a_export_type, $a_obj_type);
333 return true;
334 }
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _lookupType(int $id, bool $reference=false)
$ilErr
Definition: raiseError.php:33

References ilObject\_lookupType().

Referenced by ILIAS\Notes\Export\NotesHtmlExport\__construct(), ilObjGlossary\createExportDirectory(), ilObjFileBasedLMGUI\exportHTML(), ilExportContainer\exportObject(), ILIAS\Export\ExportHandler\Info\Export\Handler\getLegacyExportRunDir(), and ilOrgUnitExporter\sendAndCreateSimpleExportFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _generateIndexFile()

static ilExport::_generateIndexFile ( string  $a_filename,
int  $a_obj_id,
array  $a_files,
string  $a_type = "" 
)
static

@depricated Generates an index.html file including links to all xml files included (for container exports)

Definition at line 341 of file class.ilExport.php.

346 : void {
347 global $DIC;
348
349 $lng = $DIC->language();
350 $lng->loadLanguageModule("export");
351
352 if ($a_type == "") {
353 $a_type = ilObject::_lookupType($a_obj_id);
354 }
355 $a_tpl = new ilGlobalTemplate("tpl.main.html", true, true);
356 $location_stylesheet = ilUtil::getStyleSheetLocation();
357 $a_tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet);
358 $a_tpl->loadStandardTemplate();
359 $a_tpl->setTitle(ilObject::_lookupTitle($a_obj_id));
360 $a_tpl->setDescription($lng->txt("export_export_date") . ": " .
361 date('Y-m-d H:i:s', time()) . " (" . date_default_timezone_get() . ")");
362 $f_tpl = new ilTemplate("tpl.export_list.html", true, true, "components/ILIAS/Export");
363 foreach ($a_files as $file) {
364 $f_tpl->setCurrentBlock("file_row");
365 $f_tpl->setVariable("TITLE", $file["title"]);
366 $f_tpl->setVariable("TYPE", $lng->txt("obj_" . $file["type"]));
367 $f_tpl->setVariable("FILE", $file["file"]);
368 $f_tpl->parseCurrentBlock();
369 }
370 $a_tpl->setContent($f_tpl->get());
371 $index_content = $a_tpl->getSpecial("DEFAULT", false, false, false, true, false, false);
372
373 $f = fopen($a_filename, "w");
374 fwrite($f, $index_content);
375 fclose($f);
376 }
special template class to simplify handling of ITX/PEAR
static _lookupTitle(int $obj_id)
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
global $lng
Definition: privfeed.php:31

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ _getExportDirectory()

static ilExport::_getExportDirectory ( int  $a_obj_id,
string  $a_type = "xml",
string  $a_obj_type = "",
string  $a_entity = "" 
)
static

@depricated Get export directory for an repository object

Parameters
int$a_obj_idobject id
string$a_typeexport type ("xml", "html", ...), default "xml"
string$a_obj_typeobject type (optional, if not given, type is looked up)
string$a_entity
Returns
string export directory

Definition at line 216 of file class.ilExport.php.

221 : string {
222 global $DIC;
223
224 $logger = $DIC->logger()->exp();
225 $objDefinition = $DIC['objDefinition'];
226
227 $ent = ($a_entity == "")
228 ? ""
229 : "_" . $a_entity;
230
231 if ($a_obj_type == "") {
232 $a_obj_type = ilObject::_lookupType($a_obj_id);
233 }
234
235 if (in_array($a_obj_type, self::$new_file_structure)) {
236 $dir = ilFileUtils::getDataDir() . DIRECTORY_SEPARATOR;
237 $dir .= 'il' . $objDefinition->getClassName($a_obj_type) . $ent . DIRECTORY_SEPARATOR;
238 $dir .= self::createPathFromId($a_obj_id, $a_obj_type) . DIRECTORY_SEPARATOR;
239 $dir .= ($a_type == 'xml' ? 'export' : 'export_' . $a_type);
240 return $dir;
241 }
242
243 $exporter_class = ilImportExportFactory::getExporterClass($a_obj_type);
244 $export_dir = call_user_func(
245 array($exporter_class, 'lookupExportDirectory'),
246 $a_obj_type,
247 $a_obj_id,
248 $a_type,
249 $a_entity
250 );
251
252 $logger->debug('Export dir is ' . $export_dir);
253 return $export_dir;
254 }
static createPathFromId(int $a_container_id, string $a_name)
static getDataDir()
get data directory (outside webspace)

References ilObject\_lookupType().

Referenced by ILIAS\Notes\Export\NotesHtmlExport\__construct(), _getExportFiles(), ilExportContainer\addSubitems(), ilSAHSEditGUI\executeCommand(), ilObjFileBasedLMGUI\exportHTML(), ilExportContainer\exportObject(), ilDclContentExporter\getExportContentPath(), ilObjQuestionPool\getExportDirectory(), ilObjGlossary\getExportDirectory(), ILIAS\Export\ExportHandler\Info\Export\Handler\getLegacyExportRunDir(), ilObjUser\getPersonalDataExportFile(), ILIAS\Wiki\Export\WikiHtmlExport\getUserExportFile(), ilDataCollectionExportOptionsXLSX\onDeleteFiles(), ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler\onDeleteFiles(), ilMediaPoolExportOptionXMLMaster\onDeleteFiles(), ilMediaPoolExportOptionXMLMasterNoMedia\onDeleteFiles(), ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler\onDownloadFiles(), ilMediaPoolExportOptionXMLMaster\onDownloadFiles(), ilMediaPoolExportOptionXMLMasterNoMedia\onDownloadFiles(), ilOrgUnitExporter\sendAndCreateSimpleExportFile(), ilObjUser\sendPersonalDataFile(), and ILIAS\Notes\Export\NotesHtmlExport\zipPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getExportFiles()

static ilExport::_getExportFiles ( int  $a_obj_id,
  $a_export_types = "",
string  $a_obj_type = "" 
)
static

@depricated

Parameters
int$a_obj_id
string | array$a_export_types
string$a_obj_type
Returns
array

Definition at line 263 of file class.ilExport.php.

263 : array
264 {
265 if ($a_obj_type == "") {
266 $a_obj_type = ilObject::_lookupType($a_obj_id);
267 }
268
269 if ($a_export_types == "") {
270 $a_export_types = array("xml");
271 }
272 if (!is_array($a_export_types)) {
273 $a_export_types = array($a_export_types);
274 }
275
276 // initialize array
277 $file = array();
278
279 $types = $a_export_types;
280
281 foreach ($types as $type) {
282 $dir = ilExport::_getExportDirectory($a_obj_id, $type, $a_obj_type);
283
284 // quit if import dir not available
285 if (!is_dir($dir) || !is_writable($dir)) {
286 continue;
287 }
288
289 // open directory
290 $h_dir = dir($dir);
291
292 // get files and save the in the array
293 while ($entry = $h_dir->read()) {
294 if ($entry !== "." &&
295 $entry !== ".." &&
296 substr($entry, -4) === ".zip" &&
297 preg_match("/^[0-9]{10}_{2}[0-9]+_{2}(" . $a_obj_type . "_)*[0-9]+\.zip\$/", $entry)) {
298 $ts = substr($entry, 0, strpos($entry, "__"));
299 $file[$entry . $type] = [
300 "type" => (string) $type,
301 "file" => (string) $entry,
302 "size" => (int) filesize($dir . "/" . $entry),
303 "timestamp" => (int) $ts
304 ];
305 }
306 }
307
308 // close import directory
309 $h_dir->close();
310 }
311
312 // sort files
313 ksort($file);
314 reset($file);
315 return $file;
316 }

References _getExportDirectory(), ilObject\_lookupType(), and ILIAS\Repository\int().

Referenced by _getLastExportFileDate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getLastExportFileDate()

static ilExport::_getLastExportFileDate ( int  $a_obj_id,
string  $a_type = "",
string  $a_obj_type = "" 
)
static

@depricated Get date of last export file

Parameters
int$a_obj_idobject id
string$a_typeexport type ("xml", "html", ...), default "xml"
string$a_obj_typeobject type (optional, if not given, type is looked up)

Definition at line 176 of file class.ilExport.php.

176 : int
177 {
178 $files = ilExport::_getExportFiles($a_obj_id, $a_type, $a_obj_type);
179 if (is_array($files)) {
180 $files = ilArrayUtil::sortArray($files, "timestamp", "desc");
181 return (int) $files[0]["timestamp"];
182 }
183 return 0;
184 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getExportFiles(int $a_obj_id, $a_export_types="", string $a_obj_type="")
@depricated

References _getExportFiles(), and ilArrayUtil\sortArray().

Referenced by _getValidExportSubItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getLastExportFileInformation()

static ilExport::_getLastExportFileInformation ( int  $a_obj_id,
string  $a_type = "",
string  $a_obj_type = "" 
)
static

@depricated Get last export file information

Parameters
int$a_obj_idobject id
string$a_typeexport type ("xml", "html", ...), default "xml"
string$a_obj_typeobject type (optional, if not given, type is looked up)
Returns
?array

Definition at line 194 of file class.ilExport.php.

198 : ?array {
199 $files = ilExport::_getExportFiles($a_obj_id, $a_type, $a_obj_type);
200 if (is_array($files)) {
201 $files = ilArrayUtil::sortArray($files, "timestamp", "desc");
202 return $files[0];
203 }
204 return null;
205 }

References ilArrayUtil\sortArray().

+ Here is the call graph for this function:

◆ _getValidExportSubItems()

static ilExport::_getValidExportSubItems ( int  $a_ref_id)
static

Get a list of subitems of a repository resource, that implement the export.

Includes also information on last export file.

Returns
array<int, array<string, int|string>>

Definition at line 147 of file class.ilExport.php.

147 : array
148 {
149 global $DIC;
150
151 $tree = $DIC->repositoryTree();
152
153 $valid_items = array();
154 $sub_items = $tree->getSubTree($tree->getNodeData($a_ref_id));
155 foreach ($sub_items as $sub_item) {
156 if (in_array($sub_item["type"], self::$export_implementer)) {
157 $valid_items[] = [
158 "type" => (string) $sub_item["type"],
159 "title" => (string) $sub_item["title"],
160 "ref_id" => (int) $sub_item["child"],
161 "obj_id" => (int) $sub_item["obj_id"],
162 "timestamp" => ilExport::_getLastExportFileDate($sub_item["obj_id"], "xml", $sub_item["type"])
163 ];
164 }
165 }
166 return $valid_items;
167 }
static _getLastExportFileDate(int $a_obj_id, string $a_type="", string $a_obj_type="")
@depricated Get date of last export file

References $DIC, _getLastExportFileDate(), and ILIAS\Repository\int().

Referenced by ilSubItemSelectionTableGUI\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPathFromId()

static ilExport::createPathFromId ( int  $a_container_id,
string  $a_name 
)
staticprotected

Definition at line 703 of file class.ilExport.php.

703 : string
704 {
705 $max_exponent = 3;
706 $factor = 100;
707
708 $path = [];
709 $found = false;
710 $num = $a_container_id;
711 $path_string = '';
712 for ($i = $max_exponent; $i > 0; $i--) {
713 $factor = pow($factor, $i);
714 if (($tmp = (int) ($num / $factor)) or $found) {
715 $path[] = $tmp;
716 $num = $num % $factor;
717 $found = true;
718 }
719 }
720 if (count($path)) {
721 $path_string = (implode('/', $path) . '/');
722 }
723 return $path_string . $a_name . '_' . $a_container_id;
724 }
$path
Definition: ltiservices.php:30

References $path.

◆ exportEntity()

ilExport::exportEntity ( string  $a_entity,
string  $a_id,
string  $a_target_release,
string  $a_component,
string  $a_title,
string  $a_export_dir,
string  $a_type_for_file = "" 
)

@depricated Export an ILIAS entity

Parameters
string$a_entityentity type, e.g. "sty"
mixed$a_identity id
string$a_target_releasetarget release
string$a_componentcomponent that exports (e.g. "components/ILIAS/Style")
Returns
array success and info array

Definition at line 480 of file class.ilExport.php.

488 : array {
489 global $DIC;
490
491 $objDefinition = $DIC['objDefinition'];
492 $tpl = $DIC['tpl'];
493
494 // if no target release specified, use latest major release number
495 if ($a_target_release == "") {
496 $v = explode(".", ILIAS_VERSION_NUMERIC);
497 $a_target_release = $v[0] . "." . $v[1] . ".0";
498 }
499
500 if ($a_type_for_file == "") {
501 $a_type_for_file = $a_entity;
502 }
503
504 $comp = $a_component;
505 $c = explode("/", $comp);
506 $component = str_replace("_", "", $c[2]);
507 $class = "il" . $component . "Exporter";
508
509 // manifest writer
510 $this->manifest_writer = new ilXmlWriter();
511 $this->manifest_writer->xmlHeader();
512 $this->manifest_writer->xmlStartTag(
513 'Manifest',
514 array(
515 "MainEntity" => $a_entity,
516 "Title" => $a_title,
517 /* "TargetRelease" => $a_target_release, */
518 "InstallationId" => IL_INST_ID,
519 "InstallationUrl" => ILIAS_HTTP_PATH
520 )
521 );
522
523 $export_dir = $a_export_dir;
524 $ts = time();
525
526 // determine file name and subdirectory
527 $sub_dir = $ts . '__' . IL_INST_ID . '__' . $a_type_for_file . '_' . $a_id;
528 $new_file = $sub_dir . '.zip';
529
530 $this->export_run_dir = $export_dir . "/" . $sub_dir;
531 ilFileUtils::makeDirParents($this->export_run_dir);
532
533 $this->cnt = array();
534 $success = $this->processExporter($comp, $class, $a_entity, $a_target_release, [$a_id]);
535 $this->manifest_writer->xmlEndTag('Manifest');
536 $this->manifest_writer->xmlDumpFile($this->export_run_dir . "/manifest.xml", false);
537
538 // zip the file
539 ilFileUtils::zip($this->export_run_dir, $export_dir . "/" . $new_file);
540 ilFileUtils::delDir($this->export_run_dir);
541
542 return array(
543 "success" => $success,
544 "file" => $new_file,
545 "directory" => $export_dir
546 );
547 }
processExporter(string $a_comp, string $a_class, string $a_entity, string $a_target_release, ?array $a_id=null)
@depricated Process exporter
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_INST_ID
Definition: constants.php:40
$c
Definition: deliver.php:25
const ILIAS_VERSION_NUMERIC

References ILIAS_VERSION_NUMERIC.

◆ exportObject()

ilExport::exportObject ( string  $a_type,
int  $a_id,
string  $a_target_release = "" 
)

@depricated Export an ILIAS object (the object type must be known by objDefinition)

Parameters
string$a_typerepository object type
int$a_idid of object or entity that shoudl be exported
string$a_target_releasetarget release
Returns
array success and info array

Reimplemented in ilExportContainer.

Definition at line 397 of file class.ilExport.php.

401 : array {
402 $this->log->debug("export type: $a_type, id: $a_id, target_release: " . $a_target_release);
403
404 // if no target release specified, use latest major release number
405 if ($a_target_release == "") {
406 $v = explode(".", ILIAS_VERSION_NUMERIC);
407 $a_target_release = $v[0] . "." . $v[1] . ".0";
408 $this->log->debug("target_release set to: " . $a_target_release);
409 }
410
411 // manifest writer
412 $this->manifest_writer = new ilXmlWriter();
413 $this->manifest_writer->xmlHeader();
414 $this->manifest_writer->xmlStartTag(
415 'Manifest',
416 array(
417 "MainEntity" => $a_type,
418 "Title" => ilObject::_lookupTitle($a_id),
419 /* "TargetRelease" => $a_target_release, */
420 "InstallationId" => IL_INST_ID,
421 "InstallationUrl" => ILIAS_HTTP_PATH
422 )
423 );
424
425 // get export class
426 ilExport::_createExportDirectory($a_id, "xml", $a_type);
427 $export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
428 $ts = time();
429
430 // Workaround for test assessment
431 $sub_dir = $ts . '__' . IL_INST_ID . '__' . $a_type . '_' . $a_id;
432 $new_file = $sub_dir . '.zip';
433
434 $this->export_run_dir = $export_dir . "/" . $sub_dir;
435 ilFileUtils::makeDirParents($this->export_run_dir);
436 $this->log->debug("export dir: " . $this->export_run_dir);
437
438 $this->cnt = array();
439
440 $class = ilImportExportFactory::getExporterClass($a_type);
441 $comp = ilImportExportFactory::getComponentForExport($a_type);
442
443 $success = $this->processExporter($comp, $class, $a_type, $a_target_release, [$a_id]);
444
445 $this->manifest_writer->xmlEndTag('Manifest');
446 $this->manifest_writer->xmlDumpFile($this->export_run_dir . "/manifest.xml", false);
447
448 // zip the file
449 $this->log->debug("zip: " . $export_dir . "/" . $new_file);
450 $this->log->debug("run dir: " . $this->export_run_dir);
451 ilFileUtils::zip($this->export_run_dir, $export_dir . "/" . $new_file);
452 ilFileUtils::delDir($this->export_run_dir);
453
454 // Store info about export
455 if ($success) {
456 $exp = new ilExportFileInfo($a_id);
457 $exp->setVersion($a_target_release);
458 $exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX));
459 $exp->setExportType('xml');
460 $exp->setFilename($new_file);
461 $exp->create();
462 }
463
464 return array(
465 "success" => $success,
466 "file" => $new_file,
467 "directory" => $export_dir
468 );
469 }
const IL_CAL_UNIX
@classDescription Date and time handling
@classDescription Stores information of creation date and versions of export files
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")

References ILIAS_VERSION_NUMERIC.

◆ getAbsoluteExportDirectory()

ilExport::getAbsoluteExportDirectory ( )

Definition at line 115 of file class.ilExport.php.

115 : string
116 {
117 return $this->dir_absolute;
118 }
string $dir_absolute

◆ getExportConfigs()

ilExport::getExportConfigs ( )

Definition at line 137 of file class.ilExport.php.

137 : ExportConfigCollectionInterface
138 {
140 }
ExportConfigCollectionInterface $export_configs

◆ getExportDirInContainer()

ilExport::getExportDirInContainer ( )
Returns
string the path to the export directory of the current component in the container, for example: "1737382047__0__cat_100/components/ILIAS/Style/set_0

Definition at line 72 of file class.ilExport.php.

72 : string
73 {
74 return $this->export_path_info->getPathToComponentDirInContainer();
75 }

◆ getExportWriter()

ilExport::getExportWriter ( )

Definition at line 126 of file class.ilExport.php.

126 : ilExportHandlerConsumerExportWriterInterface
127 {
129 }
ilExportHandlerConsumerExportWriterInterface $export_writer

◆ getPathToComponentExpDirInContainer()

ilExport::getPathToComponentExpDirInContainer ( )
Returns
string the path to the expDir folder in the export directory of the current component in the container, for example: "1737382047__0__cat_100/components/ILIAS/Style/set_0/expDir_1

Definition at line 82 of file class.ilExport.php.

82 : string
83 {
84 return $this->export_path_info->getPathToComponentExpDirInContainer();
85 }

◆ getPathToComponentExpDirInContainerWithLeadingSetNumber()

ilExport::getPathToComponentExpDirInContainerWithLeadingSetNumber ( )

Definition at line 87 of file class.ilExport.php.

87 : string
88 {
89 return "set_" . $this->export_path_info->getSetNumber() . DIRECTORY_SEPARATOR . $this->export_path_info->getPathToComponentExpDirInContainer();
90 }

◆ getRelativeExportDirectory()

ilExport::getRelativeExportDirectory ( )

Definition at line 110 of file class.ilExport.php.

110 : string
111 {
112 return $this->dir_relative;
113 }
string $dir_relative

◆ getSetNumber()

ilExport::getSetNumber ( )

Definition at line 92 of file class.ilExport.php.

92 : int
93 {
94 return $this->export_path_info->getSetNumber();
95 }

◆ isContainerExport()

ilExport::isContainerExport ( )

Definition at line 97 of file class.ilExport.php.

97 : bool
98 {
99 return $this->export_path_info->isContainerExport();
100 }

◆ processExporter()

ilExport::processExporter ( string  $a_comp,
string  $a_class,
string  $a_entity,
string  $a_target_release,
?array  $a_id = null 
)

@depricated Process exporter

Parameters
string$a_compe.g. "components/ILIAS/Forum"
string$a_class
string$a_entitye.g. "frm"
string$a_target_releasee.g. "5.1.0"
string$a_idid of entity (e.g. object id)
Returns
bool success true/false
Exceptions
ilExportException

Definition at line 560 of file class.ilExport.php.

566 : bool {
567 $success = true;
568 $this->log->debug("process exporter, comp: " . $a_comp . ", class: " . $a_class . ", entity: " . $a_entity .
569 ", target release " . $a_target_release . ", id: " . print_r($a_id, true));
570
571 if (!is_array($a_id)) {
572 if ($a_id == "") {
573 return true;
574 }
575 $a_id = array($a_id);
576 }
577
578 // get exporter object
579 if (!class_exists($a_class)) {
580 $a_class = substr($a_class, 0, 2) . "ILIAS" . substr($a_class, 2);
581 if (!class_exists($a_class)) {
582 $export_class_file = "./" . $a_comp . "/classes/class." . $a_class . ".php";
583 if (!is_file($export_class_file)) {
584 throw new ilExportException('Export class file "' . $export_class_file . '" not found.');
585 }
586 }
587 }
588
589 $exp = new $a_class();
590 $exp->setExport($this);
591 if (!isset($this->cnt[$a_comp])) {
592 $this->cnt[$a_comp] = 1;
593 } else {
594 $this->cnt[$a_comp]++;
595 }
596 $set_dir_relative = $a_comp . "/set_" . $this->cnt[$a_comp];
597 $set_dir_absolute = $this->export_run_dir . "/" . $set_dir_relative;
598 ilFileUtils::makeDirParents($set_dir_absolute);
599 $this->log->debug("dir: " . $set_dir_absolute);
600
601 $this->log->debug("init exporter");
602 $exp->init();
603
604 // process head dependencies
605 $this->log->debug("process head dependencies for " . $a_entity);
606 $sequence = $exp->getXmlExportHeadDependencies($a_entity, $a_target_release, $a_id);
607 foreach ($sequence as $s) {
608 $comp = explode("/", $s["component"]);
609 $component = str_replace("_", "", $comp[2]);
610 $exp_class = "il" . $component . "Exporter";
611 $s = $this->processExporter(
612 $s["component"],
613 $exp_class,
614 $s["entity"],
615 $a_target_release,
616 $s["ids"]
617 );
618 if (!$s) {
619 $success = false;
620 }
621 }
622
623 // write export.xml file
625 $export_writer->xmlHeader();
626
627 $sv = $exp->determineSchemaVersion($a_entity, $a_target_release);
628 $sv["uses_dataset"] ??= false;
629 $sv['xsd_file'] ??= '';
630 $this->log->debug("schema version for entity: $a_entity, target release: $a_target_release");
631 $this->log->debug("...is: " . $sv["schema_version"] . ", namespace: " . $sv["namespace"] .
632 ", xsd file: " . $sv["xsd_file"] . ", uses_dataset: " . ((int) $sv["uses_dataset"]));
633
634 $attribs = array("InstallationId" => IL_INST_ID,
635 "InstallationUrl" => ILIAS_HTTP_PATH,
636 "Entity" => $a_entity,
637 "SchemaVersion" => $sv["schema_version"],
638 /* "TargetRelease" => $a_target_release, */
639 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
640 "xmlns:exp" => "http://www.ilias.de/Services/Export/exp/4_1",
641 "xsi:schemaLocation" => "http://www.ilias.de/Services/Export/exp/4_1 " . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_export_4_1.xsd"
642 );
643 if ($sv["namespace"] != "" && $sv["xsd_file"] != "") {
644 $attribs["xsi:schemaLocation"] .= " " . $sv["namespace"] . " " .
645 ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/" . $sv["xsd_file"];
646 $attribs["xmlns"] = $sv["namespace"];
647 }
648 if ($sv["uses_dataset"]) {
649 $attribs["xsi:schemaLocation"] .= " " .
650 "http://www.ilias.de/Services/DataSet/ds/4_3 " . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_ds_4_3.xsd";
651 $attribs["xmlns:ds"] = "http://www.ilias.de/Services/DataSet/ds/4_3";
652 }
653 $export_writer->xmlStartTag('exp:Export', $attribs);
654
655 $dir_cnt = 1;
656 foreach ($a_id as $id) {
657 $exp->setExportDirectories(
658 $set_dir_relative . "/expDir_" . $dir_cnt,
659 $set_dir_absolute . "/expDir_" . $dir_cnt
660 );
661 $export_writer->xmlStartTag('exp:ExportItem', array("Id" => $id));
662 $xml = $exp->getXmlRepresentation($a_entity, $sv["schema_version"], (string) $id);
663 $export_writer->appendXML($xml);
664 $export_writer->xmlEndTag('exp:ExportItem');
665 $dir_cnt++;
666 }
667
668 $export_writer->xmlEndTag('exp:Export');
669 $export_writer->xmlDumpFile($set_dir_absolute . "/export.xml", false);
670
671 $this->manifest_writer->xmlElement(
672 "ExportFile",
673 array("Component" => $a_comp, "Path" => $set_dir_relative . "/export.xml")
674 );
675
676 // process tail dependencies
677 $this->log->debug("process tail dependencies of " . $a_entity);
678 $sequence = $exp->getXmlExportTailDependencies($a_entity, $a_target_release, $a_id);
679 foreach ($sequence as $s) {
680 if (empty((array) ($s["ids"] ?? []))) {
681 continue;
682 }
683
684 $comp = explode("/", $s["component"]);
685 $component = str_replace("_", "", $comp[2]);
686 $exp_class = "il" . $component . "Exporter";
687 $s = $this->processExporter(
688 $s["component"],
689 $exp_class,
690 $s["entity"],
691 $a_target_release,
692 (array) $s["ids"]
693 );
694 if (!$s) {
695 $success = false;
696 }
697 }
698
699 $this->log->debug("returning " . ((int) $success) . " for " . $a_entity);
700 return $success;
701 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ setExportConfigs()

ilExport::setExportConfigs ( ExportConfigCollectionInterface  $export_configs)

Definition at line 131 of file class.ilExport.php.

133 : void {
134 $this->export_configs = $export_configs;
135 }

◆ setExportDirectories()

ilExport::setExportDirectories ( string  $a_dir_relative,
string  $a_dir_absolute 
)

Definition at line 102 of file class.ilExport.php.

105 : void {
106 $this->dir_relative = $a_dir_relative;
107 $this->dir_absolute = $a_dir_absolute;
108 }

◆ setExportWriter()

ilExport::setExportWriter ( ilExportHandlerConsumerExportWriterInterface  $export_writer)

Definition at line 120 of file class.ilExport.php.

122 : void {
123 $this->export_writer = $export_writer;
124 }

◆ setPathInfo()

ilExport::setPathInfo ( ExportPathInfoInterface  $export_path_info)

Definition at line 62 of file class.ilExport.php.

64 : void {
65 $this->export_path_info = $export_path_info;
66 }
ExportPathInfoInterface $export_path_info

Field Documentation

◆ $cnt

array ilExport::$cnt = []
private

Definition at line 53 of file class.ilExport.php.

◆ $dir_absolute

string ilExport::$dir_absolute = ""
protected

Definition at line 34 of file class.ilExport.php.

◆ $dir_relative

string ilExport::$dir_relative = ""
protected

Definition at line 33 of file class.ilExport.php.

◆ $export_configs

ExportConfigCollectionInterface ilExport::$export_configs
protected

Definition at line 38 of file class.ilExport.php.

◆ $export_implementer

array ilExport::$export_implementer = array("tst", "lm", "glo", "sahs")
staticprivate

Definition at line 52 of file class.ilExport.php.

◆ $export_path_info

ExportPathInfoInterface ilExport::$export_path_info
protected

Definition at line 37 of file class.ilExport.php.

◆ $export_run_dir

string ilExport::$export_run_dir = ''

Definition at line 32 of file class.ilExport.php.

◆ $export_writer

ilExportHandlerConsumerExportWriterInterface ilExport::$export_writer
protected

Definition at line 36 of file class.ilExport.php.

◆ $log

ilLogger ilExport::$log
protected

Definition at line 35 of file class.ilExport.php.

Referenced by ilExportContainer\exportObject().

◆ $manifest_writer

ilXmlWriter ilExport::$manifest_writer = null
private

Definition at line 54 of file class.ilExport.php.

◆ $new_file_structure

array ilExport::$new_file_structure
staticprivate
Initial value:
= array('cat',
'exc',
'crs',
'sess',
'file',
'grp',
'frm',
'usr',
'catr',
'crsr',
'grpr'
)

Definition at line 39 of file class.ilExport.php.


The documentation for this class was generated from the following file: