Commit cf197d4f135d7fcfd4e0df48facef0c4e666aced

Authored by Benjamin Renard
1 parent 5f5e337d

Fix bug when DDBASE is a symbolic link

src/CALLEXT/createVI.php
... ... @@ -31,8 +31,16 @@
31 31 set_include_path("./:".getenv("DATAMANAGER").":".getenv("REMOTEDATA").":".getenv("CALLEXT"));
32 32  
33 33 $verbose = true;
  34 +
  35 + $DDBASE=getenv("DDBASE");
  36 + if (is_link($DDBASE)) {
  37 + $DDBASE=readlink($DDBASE);
  38 + if ($DDBASE === FALSE) {
  39 + exit(0);
  40 + }
  41 + }
34 42  
35   - $LOGDIR = getenv("DDBASE")."/../LOG/";
  43 + $LOGDIR = $DDBASE."/../LOG/";
36 44 if (!is_dir($LOGDIR))
37 45 mkdir($LOGDIR, 0755, true);
38 46  
... ... @@ -122,4 +130,4 @@
122 130 if ($verbose) error_log("No DDServer Info File for $base $ViId".PHP_EOL, 3, log);
123 131 }
124 132  
125   -?>
126 133 \ No newline at end of file
  134 +?>
... ...
src/CALLEXT/getData.php
... ... @@ -36,8 +36,16 @@
36 36 putenv("PATH=./:".getenv("DDBASEBIN").":/bin:/usr/bin");
37 37 set_include_path("./:".getenv("DATAMANAGER").":".getenv("REMOTEDATA").":".getenv("CALLEXT"));
38 38 $verbose = true;
39   -
40   - $LOGDIR = getenv("DDBASE")."/../LOG/";
  39 +
  40 + $DDBASE=getenv("DDBASE");
  41 + if (is_link($DDBASE)) {
  42 + $DDBASE=readlink($DDBASE);
  43 + if ($DDBASE === FALSE) {
  44 + exit(0);
  45 + }
  46 + }
  47 +
  48 + $LOGDIR = $DDBASE."/../LOG/";
41 49  
42 50 if (!is_dir($LOGDIR))
43 51 mkdir($LOGDIR, 0755, true);
... ...
src/DATA/MANAGER/DDBaseMgr.php
... ... @@ -67,7 +67,11 @@ class DDBaseMgr
67 67 public function setViInfoFromFile($base, $ds)
68 68 {
69 69 $infoXml = new DomDocument("1.0");
70   - $infoXmlFile = getenv("DDBASE")."/../INFO/DDServer/$base/$ds.xml";
  70 + $DDBASE=getenv("DDBASE");
  71 + if (is_link($DDBASE)) {
  72 + $DDBASE=readlink($DDBASE);
  73 + }
  74 + $infoXmlFile = $DDBASE."/../INFO/DDServer/$base/$ds.xml";
71 75  
72 76 if (!file_exists($infoXmlFile))
73 77 return -100;
... ... @@ -85,7 +89,7 @@ class DDBaseMgr
85 89 $fillValue = $infoXml->getElementsByTagName("FillValue");
86 90 if ($fillValue->length > 0) $this->fillValue = $fillValue->item(0)->nodeValue;
87 91  
88   - $this->location = getenv("DDBASE")."/".$this->base."/".strtoupper($this->ViId)."/";
  92 + $this->location = $DDBASE."/".$this->base."/".strtoupper($this->ViId)."/";
89 93 $this->ViDir = $this->location;
90 94 //--------- Check if additional Info should be added to VI
91 95 // $theFormat = $infoXml->getElementsByTagName("Format")->item(0);
... ... @@ -250,7 +254,11 @@ class DDBaseMgr
250 254  
251 255 public function setInfo($infoFile)
252 256 {
253   - $fullInfoName = getenv("DDBASE")."/../INFO/bases/".$this->base."/$infoFile";
  257 + $DDBASE=getenv("DDBASE");
  258 + if (is_link($DDBASE)) {
  259 + $DDBASE=readlink($DDBASE);
  260 + }
  261 + $fullInfoName = $DDBASE."/../INFO/bases/".$this->base."/$infoFile";
254 262  
255 263 if (file_exists($fullInfoName)) unlink($fullInfoName);
256 264 //TODO errors
... ...
src/REMOTEDATA/makeProxy.php
... ... @@ -13,8 +13,16 @@
13 13 putenv("LD_LIBRARY_PATH=".getenv("LD_LIBRARY_PATH"));
14 14 putenv("PATH=./:".getenv("DDBASEBIN").":/bin:/usr/bin");
15 15 set_include_path("./:".getenv("DATAMANAGER").":".getenv("REMOTEDATA").":".getenv("CALLEXT"));
  16 +
  17 + $DDBASE=getenv("DDBASE");
  18 + if (is_link($DDBASE)) {
  19 + $DDBASE=readlink($DDBASE);
  20 + if ($DDBASE === FALSE) {
  21 + exit(0);
  22 + }
  23 + }
16 24  
17   - $LOGDIR = getenv("DDBASE")."/../LOG";
  25 + $LOGDIR = $DDBASE."/../LOG";
18 26 if (!is_dir($LOGDIR))
19 27 mkdir($LOGDIR, 0755, true);
20 28  
... ... @@ -24,7 +32,7 @@
24 32 if (file_exists(log)) unlink(log);
25 33 if (file_exists(err)) unlink(err);
26 34  
27   - define('RemoteData', getenv("DDBASE")."/../INFO");
  35 + define('RemoteData', $DDBASE."/../INFO");
28 36  
29 37 if (!file_exists(RemoteData."/Bases.xml"))
30 38 exit('No Bases.xml'.PHP_EOL);
... ... @@ -60,4 +68,4 @@
60 68 // }
61 69 }
62 70  
63   -?>
64 71 \ No newline at end of file
  72 +?>
... ...