Commit aa1e1e6d36c59e774c80a6164864ebcb91a5e46a

Authored by Benjamin Renard
1 parent efe03f29
Exists in SpeasyGet

Fix remote speasy proxy

php/RemoteDataCenter/SPEASYClientClass.php
... ... @@ -43,7 +43,7 @@ class SPEASYClientClass
43 43 return $node;
44 44 }
45 45  
46   - public function makeAllParams()
  46 + public function makeProxy()
47 47 {
48 48 $dom = new DOMDocument('1.0', 'utf-8');
49 49 $dom->formatOutput = TRUE;
... ... @@ -51,26 +51,13 @@ class SPEASYClientClass
51 51  
52 52 $node = NULL;
53 53 if ($dom->load(SPEASY_PROXY_DATA.$this->baseID."/base.xml")) {
54   - $xpath = new DOMXPath($dom);
55   - $params = $xpath->query("//parameter");
56   -
57   - foreach ($params as $param)
58   - {
59   - $paramId = $param->getAttribute('xml:id');
60   - if (is_file(SPEASY_PROXY_DATA.$this->baseID."/PARAMS/".$paramId.".xml")) {
61   - if (!is_link(PARAMS_LOCALDB_DIR.$paramId.".xml")) {
62   - if (!symlink(SPEASY_PROXY_DATA.$this->baseID."/PARAMS/".$paramId.".xml", PARAMS_LOCALDB_DIR.$paramId.".xml")) {
63   - echo "[ERROR] Cannot create symbolic link for ".$paramId.PHP_EOL;
64   - }
65   - }
66   - }
67   - else {
68   - echo "[ERROR] Missing speasy parameter file for ".$paramId.PHP_EOL;
69   - }
70   - }
  54 + if (!is_dir(RemoteData.$this->baseID))
  55 + mkdir(RemoteData.$this->baseID, 0775, true);
  56 + chmod(RemoteData.$this->baseID,0775);
  57 +
  58 + $dom->save(RemoteData.$this->baseID.'/base.xml');
71 59 }
72 60 }
73   -
74 61  
75 62 }
76 63 ?>
... ...
php/RemoteDataCenter/makeSpeasyProxy.php
... ... @@ -34,7 +34,7 @@
34 34  
35 35 if ($center->monitor())
36 36 {
37   - $center->makeAllParams();
  37 + $center->makeProxy();
38 38 }
39 39 else
40 40 {
... ...
php/classes/UserMgr.php
... ... @@ -319,7 +319,7 @@ class UserMgr
319 319 if ($basesWS->length > 0) {
320 320  
321 321 foreach ($basesWS as $base) {
322   - $basesWsId[] = $base->getAttribute('xml:id');
  322 + $basesWsId[] = $base->getAttribute('xml:id');
323 323 }
324 324  
325 325 foreach ($this->paramMgr->Bases as $baseNew) {
... ... @@ -331,7 +331,7 @@ class UserMgr
331 331 foreach ($basesWS as $base)
332 332 {
333 333 $baseId = $base->getAttribute('xml:id');
334   - $lastModif = $base->getAttribute('lastModif');
  334 + $lastModif = $base->getAttribute('lastModif');
335 335 if (!empty($lastModif)) {
336 336 $lastModif = intval($lastModif);
337 337 if (($lastModif > 0) && ((time() - $lastModif) < REMOTE_PARAMS_UPDATE_DELAY)) {
... ... @@ -427,7 +427,7 @@ class UserMgr
427 427 $BASE->setAttribute('xml:id','myRemoteData-treeRootNode');
428 428  
429 429 foreach ($this->paramMgr->Bases as $baseId)
430   - {
  430 + {
431 431 $centerNode = $this->makeNewBase($baseId);
432 432 if (isset($centerNode))
433 433 $BASE->appendChild($centerNode);
... ...