load(INFOSITE."INFO/Bases.xml")) exit("No Bases.xml file at DDBase/INFO ? no Remote bases at all".PHP_EOL); $bases = $basesDom->getElementsByTagName("dataCenter"); foreach ($bases as $base) { $baseId = $base->getAttribute("xml:id"); $baseDir = DATAPATH."/RemoteData/$baseId"; $baseDirRemote = INFOSITE."INFO/bases/$baseId"; if (!is_dir($baseDir)) mkdir($baseDir); if (!copy("$baseDirRemote/base.xml", "$baseDir/base.xml")) echo "Cannot copy base.xml for $baseId".PHP_EOL; } } // Merge with existing Bases.xml else { $basesDom = new DomDocument("1.0"); $basesDom->load(DATAPATH."/RemoteData/Bases.xml"); $basesDomRemote = new DomDocument("1.0"); if (!@$basesDomRemote->load(INFOSITE."INFO/Bases.xml")) exit("No Bases.xml file at DDBase/INFO ? IMPEX only".PHP_EOL); $basesRemote = $basesDomRemote->getElementsByTagName("dataCenter"); echo INFOSITE.PHP_EOL; foreach ($basesRemote as $baseRemote) { $baseId = $baseRemote->getAttribute("xml:id"); // add remote base if it doesn't exist if (!$basesDom->getElementById($baseId)) { $baseDir = DATAPATH."/RemoteData/$baseId"; $baseDirRemote = INFOSITE."INFO/bases/$baseId"; if (!is_dir($baseDir)) mkdir($baseDir); if (!copy("$baseDirRemote/base.xml", "$baseDir/base.xml")) { echo "Cannot copy base.xml for $baseId".PHP_EOL; } else { $baseClone = $basesDom->importNode($baseRemote); $basesDom->documentElement->appendChild($baseClone); echo "Added $baseId".PHP_EOL; if ($baseId == "THEMIS") { $center = new THEMIS(); $center->makeAllParams(); } } } } } $basesDom->save(DATAPATH."/RemoteData/Bases.xml"); ?>