Commit 3a9a18bf4b8229f1ba4e6d4178efa26395646e01

Authored by Benjamin Renard
2 parents f822811a 8c356a3d

Merge remote branch 'origin/master' into akka-scatter-multi-xparams

src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php
... ... @@ -209,6 +209,7 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface
209 209 $this->paramsData->setCompilationPath(IHMConfigClass::getCompilationPath());
210 210 $this->paramsData->setLocalBasePath(IHMConfigClass::getLocalBasePath());
211 211 $this->paramsData->setManagerFilePath(IHMConfigClass::getProcessManagerFilePath());
  212 + $this->paramsData->setTask($input->nodeType);
212 213 $this->input = $input;
213 214  
214 215 return $this->unmarshallRequest($input);
... ...
src/Request/ParamInfoRequestClass.php
... ... @@ -63,7 +63,7 @@ class ParamInfoRequestClass extends RequestAbstractClass
63 63 switch ($this->requestData->getType()) {
64 64 case ParamInfoTypeEnumClass::IMPEXPLOTINIT :
65 65 case ParamInfoTypeEnumClass::PLOTINIT :
66   - $this->runFromParamFile($dom);
  66 + $this->runFromParamFile($dom);
67 67 break;
68 68 case ParamInfoTypeEnumClass::PARAMINFO :
69 69 $this->runFromParamInfoFile($dom);
... ... @@ -76,7 +76,7 @@ class ParamInfoRequestClass extends RequestAbstractClass
76 76 //Use some internal info - Nothing to do
77 77 $this->requestData->setSuccess(true);
78 78 }
79   -
  79 +
80 80 return $this->requestData->getSuccess();
81 81 }
82 82  
... ...
src/Request/ParamsRequestImpl/ParamsRequestClass.php
... ... @@ -118,6 +118,21 @@ class ParamsRequestClass extends ProcessRequestClass
118 118 $this->requestData->setLastErrorMessage('Cannot copy param definition file for '.$key);
119 119 return false;
120 120 }
  121 + // get datasetID for statistics
  122 + $doc = new DOMDocument("1.0", "UTF-8");
  123 + if (@$doc->load($value)) {
  124 + $dsID = $doc->getElementsByTagName('dataset_id');
  125 + if ($dsID->length > 0) {
  126 + if ($dsID->item(0)->nodeValue)
  127 + $dsName = $dsID->item(0)->nodeValue;
  128 + elseif (strpos($key, 'spase_') !== false)
  129 + $dsName = 'impex';
  130 + else
  131 + $dsName = 'unknown';
  132 +
  133 + $this->requestData->addDatasetForStat($dsName);
  134 + }
  135 + }
121 136  
122 137 touch($destinationFile, filemtime($value));
123 138 }
... ... @@ -160,6 +175,7 @@ class ParamsRequestClass extends ProcessRequestClass
160 175 $doc->preserveWhiteSpace = false;
161 176 $doc->formatOutput = true;
162 177  
  178 +
163 179 if (!$xmlNode = $value["param"]->toXMLNode($doc))
164 180 {
165 181 $this->requestData->setLastErrorMessage('Cannot create params XML file for '.$key);
... ... @@ -175,6 +191,8 @@ class ParamsRequestClass extends ProcessRequestClass
175 191 return false;
176 192 }
177 193  
  194 + $this->requestData->addDatasetForStat('uploadedData');
  195 +
178 196 touch($destinationFile, $value["dateModif"]);
179 197 }
180 198 //create and copy local params files
... ... @@ -211,6 +229,11 @@ class ParamsRequestClass extends ProcessRequestClass
211 229 */
212 230 public function run()
213 231 {
  232 + $amdaStat = new AmdaStats(IHMConfigClass::getUserName());
  233 +
  234 + if (count($this->requestData->getDatasetForStat()) > 0)
  235 + $amdaStat->addTask(IHMConfigClass::getUserName(), $this->requestData->getTask(), $this->requestData->getDatasetForStat());
  236 +
214 237 return parent::run();
215 238 }
216 239  
... ...
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
... ... @@ -29,6 +29,8 @@ class ParamsRequestDataClass extends ProcessRequestDataClass
29 29 private $localParamsToCreateAndCopy = array();
30 30 private $paramsToCopy = array();
31 31 private $paramId = "";
  32 + private $datasetId = array();
  33 + private $task = "";
32 34  
33 35 function __construct()
34 36 {
... ... @@ -65,6 +67,16 @@ class ParamsRequestDataClass extends ProcessRequestDataClass
65 67 $this->requestType = $requestType;
66 68 }
67 69  
  70 + public function getTask()
  71 + {
  72 + return $this->task;
  73 + }
  74 +
  75 + public function setTask($task)
  76 + {
  77 + $this->task = $task;
  78 + }
  79 +
68 80 public function addRequestNode()
69 81 {
70 82 $newRequestNode = new RequestNodeClass();
... ... @@ -116,7 +128,17 @@ class ParamsRequestDataClass extends ProcessRequestDataClass
116 128 {
117 129 return $this->processParamsToCreate;
118 130 }
119   -
  131 +
  132 + public function getDatasetForStat()
  133 + {
  134 + return $this->datasetId;
  135 + }
  136 +
  137 + public function addDatasetForStat($dsId)
  138 + {
  139 + $this->datasetId[] = $dsId;
  140 + }
  141 +
120 142 public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling, $gap, $dateModif, $units, $ytitle)
121 143 {
122 144 $newParam = new ParamNodeClass();
... ...