From aa1e1e6d36c59e774c80a6164864ebcb91a5e46a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 18 Dec 2024 10:00:08 +0000 Subject: [PATCH] Fix remote speasy proxy --- php/RemoteDataCenter/SPEASYClientClass.php | 25 ++++++------------------- php/RemoteDataCenter/makeSpeasyProxy.php | 2 +- php/classes/UserMgr.php | 6 +++--- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/php/RemoteDataCenter/SPEASYClientClass.php b/php/RemoteDataCenter/SPEASYClientClass.php index 82fed41..bb2ab5f 100644 --- a/php/RemoteDataCenter/SPEASYClientClass.php +++ b/php/RemoteDataCenter/SPEASYClientClass.php @@ -43,7 +43,7 @@ class SPEASYClientClass return $node; } - public function makeAllParams() + public function makeProxy() { $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = TRUE; @@ -51,26 +51,13 @@ class SPEASYClientClass $node = NULL; if ($dom->load(SPEASY_PROXY_DATA.$this->baseID."/base.xml")) { - $xpath = new DOMXPath($dom); - $params = $xpath->query("//parameter"); - - foreach ($params as $param) - { - $paramId = $param->getAttribute('xml:id'); - if (is_file(SPEASY_PROXY_DATA.$this->baseID."/PARAMS/".$paramId.".xml")) { - if (!is_link(PARAMS_LOCALDB_DIR.$paramId.".xml")) { - if (!symlink(SPEASY_PROXY_DATA.$this->baseID."/PARAMS/".$paramId.".xml", PARAMS_LOCALDB_DIR.$paramId.".xml")) { - echo "[ERROR] Cannot create symbolic link for ".$paramId.PHP_EOL; - } - } - } - else { - echo "[ERROR] Missing speasy parameter file for ".$paramId.PHP_EOL; - } - } + if (!is_dir(RemoteData.$this->baseID)) + mkdir(RemoteData.$this->baseID, 0775, true); + chmod(RemoteData.$this->baseID,0775); + + $dom->save(RemoteData.$this->baseID.'/base.xml'); } } - } ?> diff --git a/php/RemoteDataCenter/makeSpeasyProxy.php b/php/RemoteDataCenter/makeSpeasyProxy.php index 7106c96..c2d45a2 100644 --- a/php/RemoteDataCenter/makeSpeasyProxy.php +++ b/php/RemoteDataCenter/makeSpeasyProxy.php @@ -34,7 +34,7 @@ if ($center->monitor()) { - $center->makeAllParams(); + $center->makeProxy(); } else { diff --git a/php/classes/UserMgr.php b/php/classes/UserMgr.php index 2baac20..d718e57 100644 --- a/php/classes/UserMgr.php +++ b/php/classes/UserMgr.php @@ -319,7 +319,7 @@ class UserMgr if ($basesWS->length > 0) { foreach ($basesWS as $base) { - $basesWsId[] = $base->getAttribute('xml:id'); + $basesWsId[] = $base->getAttribute('xml:id'); } foreach ($this->paramMgr->Bases as $baseNew) { @@ -331,7 +331,7 @@ class UserMgr foreach ($basesWS as $base) { $baseId = $base->getAttribute('xml:id'); - $lastModif = $base->getAttribute('lastModif'); + $lastModif = $base->getAttribute('lastModif'); if (!empty($lastModif)) { $lastModif = intval($lastModif); if (($lastModif > 0) && ((time() - $lastModif) < REMOTE_PARAMS_UPDATE_DELAY)) { @@ -427,7 +427,7 @@ class UserMgr $BASE->setAttribute('xml:id','myRemoteData-treeRootNode'); foreach ($this->paramMgr->Bases as $baseId) - { + { $centerNode = $this->makeNewBase($baseId); if (isset($centerNode)) $BASE->appendChild($centerNode); -- libgit2 0.21.2