webAlias); $replace = array("-" => "_"); $dataSet = strtr($_GET['id'], $replace); if (file_exists("GRANULES/$dataSet.json")) { echo file_get_contents("GRANULES/$dataSet.json"); exit(); } $ddSys = new DOMDocument('1.0'); $ddSys->load(baseDir."/DDsys.xml"); $xp = new DOMXpath($ddSys); $VI = $xp->query("//NAME[.='".$dataSet."']"); if ( $VI->item(0)->nodeValue == NULL ) exit('NO SUCH DATASET'); $main = array(); $index = array(); $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue; if (file_exists($location."RestrictedAccess")) exit(); // PrivateAccess foreach (glob($location."*.nc.gz") as $granule) { $cmd = 'stat --printf="%s" '. $granule; $file = basename($granule,".nc.gz"); $index[$file] = exec($cmd); } $main[substr($location,strlen(baseDir))] = $index; $json = json_encode($main); file_put_contents("GRANULES/$dataSet.json", $json); exit($json); ?>