if (strtolower(substr($ABS_FILE_NAME, -4)) == ".xml") { if (@mkdir($DIR_NAME = substr($ABS_FILE_NAME, 0, -4) . "_files", BX_DIR_PERMISSIONS)) { } $_SESSION["BX_CML2_EXPORT"]["work_dir"] = $WORK_DIR_NAME; $_SESSION["BX_CML2_EXPORT"]["file_dir"] = substr($DIR_NAME . "/", strlen($WORK_DIR_NAME)); } } else { $arErrors[] = GetMessage("IBLOCK_CML2_FILE_ERROR"); } $NS["STEP"]++; } elseif ($NS["STEP"] < 4) { if ($fp = fopen($ABS_FILE_NAME, "ab")) { $obExport = new CIBlockCMLExport(); if ($obExport->Init($fp, $NS["IBLOCK_ID"], $NS["next_step"], true, $_SESSION["BX_CML2_EXPORT"]["work_dir"], $_SESSION["BX_CML2_EXPORT"]["file_dir"])) { if ($NS["DOWNLOAD_CLOUD_FILES"] === "N") { $obExport->DoNotDownloadCloudFiles(); } if ($NS["STEP"] == 1) { $obExport->StartExport(); $obExport->StartExportMetadata(); $obExport->ExportProperties($_SESSION["BX_CML2_EXPORT"]["PROPERTY_MAP"]); $NS["STEP"]++; } elseif ($NS["STEP"] == 2) { $result = $obExport->ExportSections($_SESSION["BX_CML2_EXPORT"]["SECTION_MAP"], $start_time, $INTERVAL, $NS["SECTIONS_FILTER"], $_SESSION["BX_CML2_EXPORT"]["PROPERTY_MAP"]); if ($result) { $NS["SECTIONS"] += $result; } else { $obExport->EndExportMetadata(); $obExport->StartExportCatalog(); $NS["STEP"]++; }