Commit 2c928626f42a3625546dd5ea8d418a6b20ef81fb

Authored by Benjamin Renard
1 parent f0d097e2

Add info to know if a request is running from WS

src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php
... ... @@ -129,6 +129,8 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
129 129  
130 130 $this->paramsData->setBatchEnable(WSConfigClass::$enableBatch);
131 131  
  132 + $this->paramsData->setFromWS(true);
  133 +
132 134 return $this->paramsData;
133 135 }
134 136  
... ...
src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php
... ... @@ -110,6 +110,8 @@ class WSInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
110 110  
111 111 $this->paramsData->setBatchEnable(true);
112 112 $this->paramsData->setPostCmd($postProcessCmd);
  113 +
  114 + $this->paramsData->setFromWS(true);
113 115  
114 116 return $this->paramsData;
115 117 }
... ...
src/Request/ProcessRequestImpl/Process/ProcessClass.php
... ... @@ -19,16 +19,18 @@ class ProcessClass
19 19 private $pID;
20 20 private $runningPath;
21 21 private $runningStart;
  22 + private $fromWS;
22 23  
23 24 /*
24 25 * @brief Constructor
25 26 */
26   - function __construct($command, $postProcessCmd = "", $getErrorMsgCmd = "")
  27 + function __construct($command, $postProcessCmd = "", $getErrorMsgCmd = "", $fromWS = FALSE)
27 28 {
28 29 $this->command = $command;
29 30 $this->postProcessCmd = $postProcessCmd;
30 31 $this->getErrorMsgCmd = $getErrorMsgCmd;
31 32 $this->pID = 0;
  33 + $this->fromWS = $fromWS;
32 34 }
33 35  
34 36 /*
... ... @@ -187,6 +189,14 @@ class ProcessClass
187 189 }
188 190  
189 191 /*
  192 + * @brief To know if a process is running from WebService
  193 + */
  194 + public function getFromWS()
  195 + {
  196 + return $this->fromWS;
  197 + }
  198 +
  199 + /*
190 200 * @brief Run the process
191 201 */
192 202 public function run($runningPath, $envArray)
... ...
src/Request/ProcessRequestImpl/Process/ProcessManagerClass.php
... ... @@ -19,9 +19,9 @@ class ProcessManagerClass
19 19 /*
20 20 * @brief Run a process
21 21 */
22   - public function runProcess($cmd, $runningPath, $envArray, $postProcessCmd, $getErrorMsgCmd, $batchEnabled)
  22 + public function runProcess($cmd, $runningPath, $envArray, $postProcessCmd, $getErrorMsgCmd, $batchEnabled, $fromWS = FALSE)
23 23 {
24   - $process = new ProcessClass($cmd, $postProcessCmd, $getErrorMsgCmd);
  24 + $process = new ProcessClass($cmd, $postProcessCmd, $getErrorMsgCmd, $fromWS);
25 25  
26 26 if (!$process->run($runningPath, $envArray))
27 27 return array("success" => false, "message" => "Cannot run the process");
... ... @@ -168,6 +168,7 @@ class ProcessManagerClass
168 168 $this->updateProcessStatusToNode($dom,$processNode,"runningstart",$process->getRunningStart());
169 169 $this->updateProcessStatusToNode($dom,$processNode,"isrunning",$process->isRunning() ? "true" : "false");
170 170 $this->updateProcessStatusToNode($dom,$processNode,"lastupdate",time());
  171 + $this->updateProcessStatusToNode($dom,$processNode,"fromws", $process->getFromWS() ? "true" : "false");
171 172 }
172 173  
173 174 /*
... ... @@ -191,7 +192,8 @@ class ProcessManagerClass
191 192 "runningstart" => $this->getNodeValueFromNode($processNode, "runningstart"),
192 193 "isrunning" => ($this->getNodeValueFromNode($processNode, "isrunning") == "true"),
193 194 "iskilled" => ($this->getNodeValueFromNode($processNode, "iskilled") == "true"),
194   - "lastupdate" => $this->getNodeValueFromNode($processNode, "lastupdate")
  195 + "lastupdate" => $this->getNodeValueFromNode($processNode, "lastupdate"),
  196 + "fromws" => ($this->getNodeValueFromNode($processNode, "fromws") == "true"),
195 197 );
196 198 }
197 199  
... ...
src/Request/ProcessRequestImpl/ProcessRequestClass.php
... ... @@ -127,7 +127,8 @@ class ProcessRequestClass extends RequestAbstractClass
127 127 $this->requestData->getEnvVars(),
128 128 $this->requestData->getPostCmd(),
129 129 $this->requestData->getGetErrorMsgCmd(),
130   - $this->requestData->getBatchEnable());
  130 + $this->requestData->getBatchEnable(),
  131 + $this->requestData->getFromWS());
131 132 if ($result['success']) {
132 133 $return_code = TRUE;
133 134 $this->updateProcess($result['result'], $processMgr);
... ...
src/Request/ProcessRequestImpl/ProcessRequestDataClass.php
... ... @@ -49,7 +49,8 @@ class ProcessRequestDataClass extends RequestDataClass
49 49 private $errorMsg = "";
50 50 private $execTime = 0;
51 51 private $start = 0;
52   - private $runningPath = "";
  52 + private $runningPath = "";
  53 + private $fromWS = false;
53 54  
54 55 public function getManagerFilePath()
55 56 {
... ... @@ -200,6 +201,16 @@ class ProcessRequestDataClass extends RequestDataClass
200 201 {
201 202 $this->execTime = $execTime;
202 203 }
  204 +
  205 + public function getFromWS()
  206 + {
  207 + return $this->fromWS;
  208 + }
  209 +
  210 + public function setFromWS($fromWS)
  211 + {
  212 + $this->fromWS = $fromWS;
  213 + }
203 214 }
204 215  
205 216 ?>
... ...