Commit 35322ea66820dc16e836ce69723406b17246954f

Authored by Elena.Budnik
1 parent f8a71629

case of absence of master CDF

src/CALLEXT/createVI.php
@@ -38,10 +38,10 @@ @@ -38,10 +38,10 @@
38 38
39 define("log",$LOGDIR."/addVI.log"); 39 define("log",$LOGDIR."/addVI.log");
40 define("err",$LOGDIR."/addVI.err"); 40 define("err",$LOGDIR."/addVI.err");
41 - 41 +
42 if ($argc != 4) 42 if ($argc != 4)
43 { 43 {
44 - // error_log("Usage: php createVI.php <BaseID> <RemSetID> <NewVIName>".PHP_EOL, 3, err); 44 + error_log("Usage: php createVI.php <BaseID> <RemSetID> <NewVIName>".PHP_EOL, 3, err);
45 exit("Usage: php createVI.php <BaseID> <RemSetID> <NewVIName>".PHP_EOL); 45 exit("Usage: php createVI.php <BaseID> <RemSetID> <NewVIName>".PHP_EOL);
46 } 46 }
47 47
@@ -49,12 +49,21 @@ @@ -49,12 +49,21 @@
49 $remSetID = $argv[2]; 49 $remSetID = $argv[2];
50 $ViId = strtolower($argv[3]); 50 $ViId = strtolower($argv[3]);
51 51
  52 + if ($verbose)
  53 + error_log(date("Y-m-d\TH:i:s")." Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, log);
  54 + error_log(date("Y-m-d\TH:i:s")." Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, err);
  55 +
52 $baseMgr = new DDBaseMgr(); 56 $baseMgr = new DDBaseMgr();
53 57
54 $nc_prefix = strlen($ViId) > RemoteDataCenterClass::$MAX_VI_NAME_LENGTH ? 58 $nc_prefix = strlen($ViId) > RemoteDataCenterClass::$MAX_VI_NAME_LENGTH ?
55 substr($ViId, 0, RemoteDataCenterClass::$MAX_VI_NAME_LENGTH - 1): $ViId; 59 substr($ViId, 0, RemoteDataCenterClass::$MAX_VI_NAME_LENGTH - 1): $ViId;
56 60
57 - if ($baseMgr->viExists($ViId, $base)) die("$ViId Already Exists!!!".PHP_EOL); 61 + if ($baseMgr->viExists($ViId, $base)) {
  62 + if ($verbose)
  63 + error_log($base." : ".$ViId." already Exists!!!".PHP_EOL, 3, log);
  64 +
  65 + die("$ViId Already Exists!!!".PHP_EOL);
  66 + }
58 67
59 $baseMgr->setViId($ViId); 68 $baseMgr->setViId($ViId);
60 $baseMgr->setViInfo($nc_prefix); 69 $baseMgr->setViInfo($nc_prefix);
@@ -63,10 +72,6 @@ @@ -63,10 +72,6 @@
63 if ($status === 0) 72 if ($status === 0)
64 { 73 {
65 $baseMgr->createVi(); 74 $baseMgr->createVi();
66 -  
67 - if ($verbose)  
68 - error_log("Request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, log);  
69 -  
70 $center = new $base(); 75 $center = new $base();
71 76
72 $startStamp = strtotime($baseMgr->globalStart); 77 $startStamp = strtotime($baseMgr->globalStart);
@@ -88,7 +93,12 @@ @@ -88,7 +93,12 @@
88 93
89 if (!$infoFile && $ncFiles) 94 if (!$infoFile && $ncFiles)
90 { 95 {
91 - $baseMgr->setInfo($ncFiles[0]); 96 + if ($verbose)
  97 + error_log("No dataset info file for ".$remSetID." from ".$dataBaseID." uses regular file".PHP_EOL, 3, log);
  98 +
  99 + $infoFileName = strtolower($remSetID).".nc";
  100 + copy($ncFiles[0], $infoFileName);
  101 + $baseMgr->setInfo($infoFileName);
92 } 102 }
93 103
94 $baseMgr->addRemoteData($remSetID, $ncFiles, $startIso, $stopIso); 104 $baseMgr->addRemoteData($remSetID, $ncFiles, $startIso, $stopIso);
src/DATA/MANAGER/DDBaseMgr.php
@@ -256,10 +256,7 @@ class DDBaseMgr @@ -256,10 +256,7 @@ class DDBaseMgr
256 //TODO errors 256 //TODO errors
257 //if (!file_exists($infoFile)) 257 //if (!file_exists($infoFile))
258 $WORKING_DIR = getcwd(); 258 $WORKING_DIR = getcwd();
259 - echo "$WORKING_DIR/$infoFile, $fullInfoName".PHP_EOL;  
260 rename("$WORKING_DIR/$infoFile", $fullInfoName); 259 rename("$WORKING_DIR/$infoFile", $fullInfoName);
261 -  
262 - //system("gunzip -c ".$this->ViDir."/$ncFile.gz > $fullAliasName");  
263 } 260 }
264 261
265 public function updateRemoteStart() 262 public function updateRemoteStart()
src/REMOTEDATA/CDAWEB.php
@@ -40,8 +40,8 @@ class CDAWEB extends RemoteDataCenterClass @@ -40,8 +40,8 @@ class CDAWEB extends RemoteDataCenterClass
40 40
41 public function init() 41 public function init()
42 { 42 {
43 - error_log("CDAWEB Proxy creation on ".date("Y-m-d").PHP_EOL,3,log);  
44 - error_log("CDAWEB Proxy creation on ".date("Y-m-d").PHP_EOL,3,err); 43 + error_log("CDAWEB Proxy creation on ".date("Y-m-d\TH:i:s").PHP_EOL,3,log);
  44 + error_log("CDAWEB Proxy creation on ".date("Y-m-d\TH:i:s").PHP_EOL,3,err);
45 45
46 $this->getAllSpaseDatasets(); 46 $this->getAllSpaseDatasets();
47 } 47 }
@@ -469,10 +469,12 @@ class CDAWEB extends RemoteDataCenterClass @@ -469,10 +469,12 @@ class CDAWEB extends RemoteDataCenterClass
469 469
470 public function getDatasetInfo($ds) 470 public function getDatasetInfo($ds)
471 { 471 {
472 - $masterCdf = strtolower($ds)."_00000000_v01.cdf"; 472 + if (!$this->existsMasterCdf($ds)) return false;
  473 +
  474 + $masterCdf = $this->getMasterCdf($ds);
473 $localCdf = strtolower($ds).".cdf"; 475 $localCdf = strtolower($ds).".cdf";
474 476
475 - if (!copy(CDAWebConfigClass::$masterUrl."/".$masterCdf, strtolower($ds).".cdf")) return false; 477 + if (!copy($masterCdf, $localCdf)) return false;
476 478
477 $infoFile = $this->convert2nc($localCdf); 479 $infoFile = $this->convert2nc($localCdf);
478 480