diff --git a/src/CALLEXT/createVI.php b/src/CALLEXT/createVI.php index f66cd02..105d52b 100755 --- a/src/CALLEXT/createVI.php +++ b/src/CALLEXT/createVI.php @@ -38,10 +38,10 @@ define("log",$LOGDIR."/addVI.log"); define("err",$LOGDIR."/addVI.err"); - + if ($argc != 4) { - // error_log("Usage: php createVI.php ".PHP_EOL, 3, err); + error_log("Usage: php createVI.php ".PHP_EOL, 3, err); exit("Usage: php createVI.php ".PHP_EOL); } @@ -49,12 +49,21 @@ $remSetID = $argv[2]; $ViId = strtolower($argv[3]); + if ($verbose) + error_log(date("Y-m-d\TH:i:s")." Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, log); + error_log(date("Y-m-d\TH:i:s")." Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, err); + $baseMgr = new DDBaseMgr(); $nc_prefix = strlen($ViId) > RemoteDataCenterClass::$MAX_VI_NAME_LENGTH ? substr($ViId, 0, RemoteDataCenterClass::$MAX_VI_NAME_LENGTH - 1): $ViId; - if ($baseMgr->viExists($ViId, $base)) die("$ViId Already Exists!!!".PHP_EOL); + if ($baseMgr->viExists($ViId, $base)) { + if ($verbose) + error_log($base." : ".$ViId." already Exists!!!".PHP_EOL, 3, log); + + die("$ViId Already Exists!!!".PHP_EOL); + } $baseMgr->setViId($ViId); $baseMgr->setViInfo($nc_prefix); @@ -63,10 +72,6 @@ if ($status === 0) { $baseMgr->createVi(); - - if ($verbose) - error_log("Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, log); - $center = new $base(); $startStamp = strtotime($baseMgr->globalStart); @@ -88,7 +93,12 @@ if (!$infoFile && $ncFiles) { - $baseMgr->setInfo($ncFiles[0]); + if ($verbose) + error_log("No dataset info file for ".$remSetID." from ".$dataBaseID." uses regular file".PHP_EOL, 3, log); + + $infoFileName = strtolower($remSetID).".nc"; + copy($ncFiles[0], $infoFileName); + $baseMgr->setInfo($infoFileName); } $baseMgr->addRemoteData($remSetID, $ncFiles, $startIso, $stopIso); diff --git a/src/DATA/MANAGER/DDBaseMgr.php b/src/DATA/MANAGER/DDBaseMgr.php index e26641f..5de7b5e 100644 --- a/src/DATA/MANAGER/DDBaseMgr.php +++ b/src/DATA/MANAGER/DDBaseMgr.php @@ -256,10 +256,7 @@ class DDBaseMgr //TODO errors //if (!file_exists($infoFile)) $WORKING_DIR = getcwd(); - echo "$WORKING_DIR/$infoFile, $fullInfoName".PHP_EOL; rename("$WORKING_DIR/$infoFile", $fullInfoName); - - //system("gunzip -c ".$this->ViDir."/$ncFile.gz > $fullAliasName"); } public function updateRemoteStart() diff --git a/src/REMOTEDATA/CDAWEB.php b/src/REMOTEDATA/CDAWEB.php index 08882ed..bafb18e 100644 --- a/src/REMOTEDATA/CDAWEB.php +++ b/src/REMOTEDATA/CDAWEB.php @@ -40,8 +40,8 @@ class CDAWEB extends RemoteDataCenterClass public function init() { - error_log("CDAWEB Proxy creation on ".date("Y-m-d").PHP_EOL,3,log); - error_log("CDAWEB Proxy creation on ".date("Y-m-d").PHP_EOL,3,err); + error_log("CDAWEB Proxy creation on ".date("Y-m-d\TH:i:s").PHP_EOL,3,log); + error_log("CDAWEB Proxy creation on ".date("Y-m-d\TH:i:s").PHP_EOL,3,err); $this->getAllSpaseDatasets(); } @@ -469,10 +469,12 @@ class CDAWEB extends RemoteDataCenterClass public function getDatasetInfo($ds) { - $masterCdf = strtolower($ds)."_00000000_v01.cdf"; + if (!$this->existsMasterCdf($ds)) return false; + + $masterCdf = $this->getMasterCdf($ds); $localCdf = strtolower($ds).".cdf"; - if (!copy(CDAWebConfigClass::$masterUrl."/".$masterCdf, strtolower($ds).".cdf")) return false; + if (!copy($masterCdf, $localCdf)) return false; $infoFile = $this->convert2nc($localCdf); -- libgit2 0.21.2