public function sendAndCreateSimpleExportFile() { $orgu_id = ilObjOrgUnit::getRootOrgId(); $orgu_ref_id = ilObjOrgUnit::getRootOrgRefId(); ilExport::_createExportDirectory($orgu_id, "xml", "orgu"); $export_dir = ilExport::_getExportDirectory($orgu_id, "xml", "orgu"); $ts = time(); // Workaround for test assessment $sub_dir = $ts . '__' . IL_INST_ID . '__' . "orgu" . '_' . $orgu_id . ""; $new_file = $sub_dir . '.zip'; $export_run_dir = $export_dir . "/" . $sub_dir; ilUtil::makeDirParents($export_run_dir); $writer = $this->simpleExport($orgu_ref_id); $writer->xmlDumpFile($export_run_dir . "/manifest.xml", false); // zip the file ilUtil::zip($export_run_dir, $export_dir . "/" . $new_file); ilUtil::delDir($export_run_dir); // Store info about export include_once './Services/Export/classes/class.ilExportFileInfo.php'; $exp = new ilExportFileInfo($orgu_id); $exp->setVersion(ILIAS_VERSION_NUMERIC); $exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX)); $exp->setExportType('xml'); $exp->setFilename($new_file); $exp->create(); ilUtil::deliverFile($export_dir . "/" . $new_file, $new_file); return array("success" => true, "file" => $new_file, "directory" => $export_dir); }