Commit ad2674cc420ee816b25241adf5ce2d73a9b28428
1 parent
be54b8da
Exists in
SpeasyGet
Fix remote speasy proxy
Showing
2 changed files
with
40 additions
and
1 deletions
Show diff stats
src/InputOutput/IHMImpl/Config/IHMConfigClass.php
... | ... | @@ -197,6 +197,11 @@ class IHMConfigClass |
197 | 197 | { |
198 | 198 | return PARAMS_LOCALDB_DIR; |
199 | 199 | } |
200 | + | |
201 | + public static function getSpeasyParamDBPath($provider) | |
202 | + { | |
203 | + return SPEASY_PROXY_DATA.'SPEASY_'.$provider.'/PARAMS/'; | |
204 | + } | |
200 | 205 | |
201 | 206 | public static function getLocalParamInfoPath() |
202 | 207 | { | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -45,7 +45,9 @@ class IHMParamManagerClass |
45 | 45 | else if ($this->isUploadedParam($param)) |
46 | 46 | return $this->addUploadedParam($param,$paramsData); |
47 | 47 | else if ($this->isImpexParam($param)) |
48 | - return $this->addImpexParam($param,$paramsData,$templateArgs); | |
48 | + return $this->addImpexParam($param,$paramsData,$templateArgs); | |
49 | + else if ($this->isSpeasyParam($param)) | |
50 | + return $this->addSpeasyParam($param,$paramsData,$templateArgs); | |
49 | 51 | else if($this->isTTCatParam($param)) |
50 | 52 | return $this->addTTCatParam($param,$paramsData); |
51 | 53 | else |
... | ... | @@ -252,6 +254,14 @@ class IHMParamManagerClass |
252 | 254 | return preg_match("#^".IHMImpexParamClass::$paramPrefix."#",$param); |
253 | 255 | } |
254 | 256 | |
257 | + /* | |
258 | + * @brief Detect if it's Speasy parameter | |
259 | + */ | |
260 | + private function isSpeasyParam($param) | |
261 | + { | |
262 | + return preg_match("#^SPEASY_#",$param); | |
263 | + } | |
264 | + | |
255 | 265 | /* |
256 | 266 | * @brief Split param components if defined |
257 | 267 | */ |
... | ... | @@ -315,6 +325,30 @@ class IHMParamManagerClass |
315 | 325 | return array("id" => $real_param_id, "indexes" => $indexes, "calib_infos" => $calib_infos, "path" => $paramPath); |
316 | 326 | } |
317 | 327 | |
328 | + /* | |
329 | + * @brief Add a speasy parameter | |
330 | + */ | |
331 | + private function addSpeasyParam($param, $paramsData, $templateArgs) | |
332 | + { | |
333 | + //speasy parameter | |
334 | + $res = $this->splitParamComponents($param); | |
335 | + $indexes = $res['indexes']; | |
336 | + $paramId = $res['param']; | |
337 | + | |
338 | + //extract speasy provider from paramId | |
339 | + $split = explode("_", $paramId); | |
340 | + $provider = $split[1]; | |
341 | + | |
342 | + | |
343 | + $paramPath = IHMConfigClass::getSpeasyParamDBPath($provider).$paramId.".xml"; | |
344 | + if (!file_exists($paramPath)) | |
345 | + throw new Exception('Cannot find speasy parameter file '.$paramId); | |
346 | + | |
347 | + $paramsData->addParamToCopy($paramId,$paramPath); | |
348 | + | |
349 | + return array("id" => $paramId, "indexes" => $indexes, "path" => $paramPath); | |
350 | + } | |
351 | + | |
318 | 352 | /* |
319 | 353 | * @brief Add linked parameter |
320 | 354 | */ | ... | ... |