protected function exportTrackerDataFromFixture($fixture) { $this->loadFixtures($fixture); $this->exporter->exportTrackerData($this->tracker_id); $this->xml = simplexml_import_dom($this->dom); }
private function exportTV3Data($tv3_id) { $this->logger->info('--> Export TV3 data '); $xml_path = $this->generateTemporaryPath(); $indent_xsl_path = $this->getIndentXSLResourcePath(); $xml = new DOMDocument("1.0", "UTF8"); $dao = new ArtifactXMLExporterDao(); $node_helper = new ArtifactXMLNodeHelper($xml); $attachment_exporter = new ArtifactAttachmentXMLLinker($node_helper, $dao); $exporter = new ArtifactXMLExporter($dao, $attachment_exporter, $node_helper, $this->logger); $exporter->exportTrackerData($tv3_id); $this->logger->info('<-- TV3 data exported ' . PHP_EOL); $xml_security = new XML_Security(); $xml_security->enableExternalLoadOfEntities(); $xsl = new DOMDocument(); $xsl->load($indent_xsl_path); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $xml_string = $proc->transformToXML($xml); $xml_security->disableExternalLoadOfEntities(); if (file_put_contents($xml_path, $xml_string) !== strlen($xml_string)) { throw new Exception('Something went wrong when writing tv3 xml in ' . $xml_path); } return $xml_path; }
if (!$overwrite && file_exists($archive_path)) { echo "*** ERROR: File {$archive_path} already exists." . PHP_EOL; exit(1); } try { $xml = new DOMDocument("1.0", "UTF8"); $logger = new Log_ConsoleLogger(); $archive = new ZipArchive(); if ($archive->open($archive_path, ZipArchive::CREATE) !== true) { echo '*** ERROR: Cannot create archive: ' . $archive_path; exit(1); } $dao = new ArtifactXMLExporterDao(); $node_helper = new ArtifactXMLNodeHelper($xml); $attachment_exporter = new ArtifactAttachmentXMLZipper($node_helper, $dao, $archive, $debug); $exporter = new ArtifactXMLExporter($dao, $attachment_exporter, $node_helper, $logger); $exporter->exportTrackerData($atid); if (!$debug) { $validator = new XML_RNGValidator(); $validator->validate(simplexml_import_dom($xml), realpath(dirname(TRACKER_BASE_DIR) . '/www/resources/artifacts.rng')); } $xml_security = new XML_Security(); $xml_security->enableExternalLoadOfEntities(); $xsl = new DOMDocument(); $xsl->load(dirname(__FILE__) . '/xml/indent.xsl'); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $archive->addFromString('artifacts.xml', $proc->transformToXML($xml)); $xml_security->disableExternalLoadOfEntities(); $archive->close(); } catch (XML_ParseException $exception) {