3 declare(strict_types=1);
44 public function exportObject(
string $a_type,
int $a_id,
string $a_target_release =
""): array
49 if ($a_target_release ==
"") {
51 $a_target_release = $v[0] .
"." . $v[1] .
".0";
58 $sub_dir = $ts .
"__" .
IL_INST_ID .
"__" . $a_type .
"_" . $a_id;
60 $this->cont_export_dir = $export_dir . DIRECTORY_SEPARATOR . $sub_dir;
63 $log->
debug(
'Using base directory: ' . $this->export_run_dir);
67 $this->
addSubitems($a_id, $a_type, $a_target_release);
78 $this->cont_manifest_writer->xmlHeader();
79 $this->cont_manifest_writer->xmlStartTag(
82 "MainEntity" => $a_type,
86 "InstallationUrl" => ILIAS_HTTP_PATH
95 protected function addSubitems(
int $a_id,
string $a_type,
string $a_target_release): void
98 foreach ($this->eo->getSubitemsForExport() as
$ref_id) {
110 $exp_full = $exp_dir . DIRECTORY_SEPARATOR . $expi->getFilename();
112 $this->log->debug(
'Zip path ' . $exp_full);
121 $new_path_rel =
'set_' . $set_number . DIRECTORY_SEPARATOR . $expi->getBasename();
122 $new_path_abs = $this->cont_export_dir . DIRECTORY_SEPARATOR . $new_path_rel;
124 $this->log->debug($new_path_rel .
' ' . $new_path_abs);
128 $exp_dir . DIRECTORY_SEPARATOR . $expi->getBasename(),
132 $this->log->debug($exp_dir . DIRECTORY_SEPARATOR . $expi->getBasename() .
' -> ' . $new_path_abs);
135 if ($a_id == $obj_id) {
137 if (file_exists($exp_full)) {
138 $this->log->info(
'Deleting' . $exp_full);
143 $this->cont_manifest_writer->xmlElement(
146 'Path' => $new_path_rel,
156 $this->cont_manifest_writer->xmlEndTag(
'Manifest');
157 $this->log->debug($this->cont_export_dir . DIRECTORY_SEPARATOR .
'manifest.xml');
158 $this->cont_manifest_writer->xmlDumpFile($this->cont_export_dir . DIRECTORY_SEPARATOR .
'manifest.xml',
true);
exportObject(string $a_type, int $a_id, string $a_target_release="")
__construct(ilExportOptions $eo)
Constructor.
const ILIAS_VERSION_NUMERIC
debug(string $a_message, array $a_context=array())
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupLastExport(int $a_obj_id, string $a_type, string $a_version='')
Lookup last export.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
manifestWriterEnd(string $a_type, int $a_id, string $a_target_release)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
ilXmlWriter $cont_manifest_writer
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
manifestWriterBegin(string $a_type, int $a_id, string $a_target_release)
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addSubitems(int $a_id, string $a_type, string $a_target_release)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
static _lookupType(int $id, bool $reference=false)