diff --git a/conf/_install/dependency.xml b/conf/_install/dependency.xml index 10421c3c1ef9fafa233227aefd87e8b32e693f74..9d8af764f60a4b224ba93cb24c01e1bfaa747fac 100644 --- a/conf/_install/dependency.xml +++ b/conf/_install/dependency.xml @@ -28,12 +28,12 @@ <version>2018.02.00</version> </dependency> <dependency> - <nature>web_services</nature> + <nature>modules</nature> <name>module_cadastreV2</name> <version>2018.03.00</version> </dependency> <dependency> - <nature>web_services</nature> + <nature>modules</nature> <name>module_cadastre</name> <version>2018.02.02</version> </dependency> diff --git a/src/module_gtf/gtf.engine/gtf.engines/Traitement.class.inc b/src/module_gtf/gtf.engine/gtf.engines/Traitement.class.inc index 1a5c2f39e252daa395ee5fddd73a4a2bc1b43c75..e1968f39a8f563f0c4f63740164a8e336f107298 100755 --- a/src/module_gtf/gtf.engine/gtf.engines/Traitement.class.inc +++ b/src/module_gtf/gtf.engine/gtf.engines/Traitement.class.inc @@ -132,7 +132,7 @@ class Traitement { $aLigne = explode("|", $sAllParams); //$aLigne = stringExplode($sAllParams, "|", "\"", "\""); foreach ($aLigne as $sValeur) { - $aValeurs = explode("=", $sValeur, 2); + $aValeurs = explode("=", $sValeur); if ($aValeurs[1] == "") { writeToLog(INFO_NULL_ELEMENT . $aValeurs[0] . ".", $this->sRobotLogFile); } @@ -234,11 +234,8 @@ class Traitement { function unZipSource($sParam) { $this->sSource = $sParam; // Si la chaine contient un accent, la chaine sera en UTF-8, la fonction file_exists et la fonction de dézippage ne gèrent pas utf-8, il faut donc convertir la chaine en ISO-8859-1 - $bUtf8Param = false; - if (mb_check_encoding($sParam, 'UTF-8')) { + if (mb_check_encoding($sParam, 'UTF-8')) $sParam = utf8_decode($sParam); - $bUtf8Param = true; - } // Si le fichier n'est pas trouvé alors il se trouve dans le répertoire upload if (!file_exists($sParam)) $sParam = $this->aProperties["upload_dir"] . "/" . $sParam; @@ -251,9 +248,6 @@ class Traitement { $sDir = $sParam; $this->sSourceTemp = ""; } - // Si le paramètre passé était encodé en UTF-8 il faut le réencoder sinon problème avec les accents. - if ($bUtf8Param) - $sDir = utf8_encode($sDir); return $sDir; } @@ -289,50 +283,30 @@ class Traitement { * $sDirSource : Chaine de caractère contenant le chemin d'accés à la source de données */ - function updateSourceParam($oGui, $oGtfFmwParser, $sDirSource, $bUsePattern) { - $sdelimiterFichier = '"""'; - $sdelimiterParam = '"'; + function updateSourceParam($oGui, $oGtfFmwParser, $sDirSource) { + $sdelimiterFichier = '""'; + $sdelimiterParam = '""'; $sSourceMacro = $sdelimiterFichier; - $aSourceMacro = array(); $i = 0; if (is_dir($sDirSource)) { - $this->aExtension = $oGui->getExtensionArrayNoLower($oGui->sFiltreSource); + $this->aExtension = $oGui->getExtensionArray($oGui->sFiltreSource); $iExtension = count($this->aExtension); if (($this->aExtension[0] == "*.*" and $oGui->sType == "FILE_OR_URL") or $oGui->sType == "DIRNAME_SRC" or $oGui->sType == "SOURCE_GEODATABASE") { writeToLog(INFO_VALID_DATA_SOURCE_FILE_EXTENSION . $this->aExtension[0], $this->sRobotLogFile); $sSourceMacro.= $sdelimiterParam . $sDirSource . '/**/' . $sdelimiterParam; } else { - if ($bUsePattern){ - writeToLog(INFO_USE_PATTERN, $this->sRobotLogFile); - foreach ($this->aExtension as $sExtension) { - if ($sExtension != "*.*" or ( $sExtension == "*.*" and $iExtension == 1)) { // Si le filtre est différent de *.* (ex : *.mdb) ou si le filtre est seulement *.*. Si le filtre est multiple et que l'un d'eux est *.* (ex : *.*, *.mdb...), il ne sera pas pris en compte - $aExtension = explode(".", $sExtension); - if ($this->countFilesExtension($sDirSource, $aExtension[1]) > 0) { - if ($i != 0) - $sSourceMacro.= "<space>"; - writeToLog(INFO_VALID_DATA_SOURCE_FILE_EXTENSION . $sExtension, $this->sRobotLogFile); - $sSourceMacro.= $sdelimiterParam . $sDirSource . '/**/' . $sExtension . $sdelimiterParam; - $i++; - } - } - } - }else{ - writeToLog(INFO_NO_USE_PATTERN, $this->sRobotLogFile); - foreach ($this->aExtension as $sExtension) { - if ($sExtension != "*.*" or ( $sExtension == "*.*" and $iExtension == 1)) { // Si le filtre est différent de *.* (ex : *.mdb) ou si le filtre est seulement *.*. Si le - $aExtension = explode(".", $sExtension); - $aSourceMacroTmp = array_merge($aSourceMacro, $this->returnFileListToString($sDirSource, $aExtension[1])); - $aSourceMacro = array_unique($aSourceMacroTmp); - $i++; - } - } - foreach ($aSourceMacro as $source) { - if ($sSourceMacro != $sdelimiterFichier){ - $sSourceMacro.= "<space>"; - } - $sSourceMacro.= $sdelimiterParam . $source . $sdelimiterParam; - } + foreach ($this->aExtension as $sExtension) { + if ($sExtension != "*.*" or ( $sExtension == "*.*" and $iExtension == 1)) { // Si le filtre est différent de *.* (ex : *.mdb) ou si le filtre est seulement *.*. Si le filtre est multiple et que l'un d'eux est *.* (ex : *.*, *.mdb...), il ne sera pas pris en compte + $aExtension = explode(".", $sExtension); + if ($this->countFilesExtension($sDirSource, $aExtension[1]) > 0) { + if ($i != 0) + $sSourceMacro.= "<space>"; + writeToLog(INFO_VALID_DATA_SOURCE_FILE_EXTENSION . $sExtension, $this->sRobotLogFile); + $sSourceMacro.= $sdelimiterParam . $sDirSource . '/**/' . $sExtension . $sdelimiterParam; + $i++; + } + } } } }else { @@ -340,7 +314,6 @@ class Traitement { } $sSourceMacro .= $sdelimiterFichier; $this->aParametre[$oGui->sDefault_Macro] = $sSourceMacro; - return $sSourceMacro; } @@ -351,7 +324,7 @@ class Traitement { $num = 0; if (!is_dir($sDirSource)) { $path_parts = pathinfo($sDirSource); - if (is_file($sDirSource) && $path_parts['extension'] == $sExtension) + if (is_file($sDirSource) && strtoupper($path_parts['extension']) == strtoupper($sExtension)) return 1; else return false; @@ -362,26 +335,6 @@ class Traitement { } return $num; } - - function returnFileListToString($sDirSource, $sExtension) { - $aFileList = array(); - if (!is_dir($sDirSource)) { - $path_parts = pathinfo($sDirSource); - if (is_file($sDirSource) && strtolower($path_parts['extension']) == strtolower($sExtension)){ - array_push($aFileList,$sDirSource); - } - - }else{ - foreach (scandir($sDirSource) AS $entry) { - if (!in_array($entry, array('..', '.'))){ - $aFileListTmp = $aFileList; - $aFileList = array_merge($aFileListTmp,$this->returnFileListToString($sDirSource . "/" . $entry, $sExtension)); - } - - } - } - return $aFileList; - } /* * Fonction qui se charge de la mise à jour du paramètre "source" s'il existe @@ -513,6 +466,9 @@ class Traitement { $cChr = $this->unichr($iCode); $sReplaced = str_replace($matches[0][$i], $cChr, $sReplaced); } + if (mb_detect_encoding($sReplaced, "UTF-8, ISO-8859-1") != "ISO-8859-1") { + $sReplaced = iconv("UTF-8", "ISO-8859-1", $sReplaced); + } return $sReplaced; } @@ -528,6 +484,7 @@ class Traitement { function isEncode($sStr) { for ($i = 0; $i < count($this->aReplaceFME); $i++) { if (strpos($sStr, $this->aReplaceFME[$i]) === false && strpos($sStr, $this->aReplaceGTF[$i]) !== false) { + error_log($this->aReplaceFME[$i]); return false; } } @@ -545,23 +502,17 @@ class Traitement { function getTclParams($oGtfFmwParser, $sNewDir) { $aTGui = array(); $sChaine = ""; - $bUsePattern = false; foreach ($oGtfFmwParser->aGuiObject as $aGui) { if ($aGui->sDefault_Macro != "") { array_push($aTGui, $aGui); } - if ($aGui->sDefault_Macro == "GTF_FORCE_PATTERN") { - if (strtolower($aGui->sDefaultValue) == "true"){ - $bUsePattern = true; - } - } } foreach ($aTGui as $oGui) { //Teste si le paramètre est une source if ($oGui->bIsSource) { if ($this->aParametre[$oGui->sDefault_Macro] != "" && substr($this->aParametre[$oGui->sDefault_Macro], 0, 7) != "<quote>") { $sDirSource = $this->unZipSource($this->aParametre[$oGui->sDefault_Macro]); - $this->updateSourceParam($oGui, $oGtfFmwParser, $sDirSource, $bUsePattern); + $this->updateSourceParam($oGui, $oGtfFmwParser, $sDirSource); } } if ($oGui->bIsDest) { @@ -603,20 +554,19 @@ class Traitement { $sGTFOutput = $this->decoderFME($sGTFOutput); break; default : - //$sGTFOutput = str_replace('"', '""', $sGTFOutput); + $sGTFOutput = str_replace('"', '""', $sGTFOutput); if (!$this->isDecode($sGTFOutput)) $sGTFOutput = $this->decoderFME($sGTFOutput); break; } - // Echappement des doubles quotes pour FME. - $sGTFOutput = str_replace('"', '\"', $sGTFOutput); - // + $sChaine .= " --" . $oGui->sDefault_Macro . " \"" . $sGTFOutput . "\""; } } // $sChaine = substr($sChaine, 0, -1)."\""; //$sChaine = substr($sChaine, 0, -1); + return $sChaine; } @@ -712,30 +662,8 @@ class Traitement { $sTclParams = $this->getTclParams($oGtfFmwParser, $sNewDir); if ($sTclParams != "") $sCommandLine .= $sTclParams; - - $aTGui = array(); - $sChaine = ""; - // Ajout des paramètres GTF_ s'ils sont associés à un paramètre publié du traitement - foreach ($oGtfFmwParser->aGuiObject as $aGui) { - switch($aGui->sDefault_Macro) { - case 'GTF_ORDER_ID': - $sCommandLine .= " --GTF_ORDER_ID \"" . $this->iDemandeId . "\""; - break; - case 'GTF_SHARED_DIR': - $sCommandLine .= " --GTF_SHARED_DIR \"" . $this->aProperties["shared_dir"] . "\""; - break; - case 'GTF_CONNECTION_STRING': - if ($aGui->sType == "PASSWORD"){ - $sCommandLine .= " --GTF_CONNECTION_STRING \"" . $this->aProperties["server"] . "," . $this->aProperties["port"] . "," . $this->aProperties["database"] . "," . $this->aProperties["login_scheduler"] . "," . $this->aProperties["password_scheduler"] . "\""; - } - break; - case 'GTF_REST_URL': - $sCommandLine .= " --GTF_REST_URL \"" . $this->aProperties["web_server_name"] . "/" . $this->aProperties["services_alias"] . "/\""; - break; - //case 'GTF_FORCE_PATTERN': - } - - } + // Ajout de trois paramètres GTF_ORDER_ID, GTF_SHARED_DIR et GTF_CONNECTION_STRING qui seront passés à chaque demande de traitement + $sCommandLine .= " --GTF_ORDER_ID \"" . $this->iDemandeId . "\" --GTF_SHARED_DIR \"" . $this->aProperties["shared_dir"] . "\" --GTF_CONNECTION_STRING \"" . $this->aProperties["server"] . "," . $this->aProperties["port"] . "," . $this->aProperties["database"] . "," . $this->aProperties["login_scheduler"] . "," . $this->aProperties["password_scheduler"] . "\" --GTF_REST_URL \"" . $this->aProperties["web_server_name"] . "/" . $this->aProperties["services_alias"] . "/\"" ; /* * 2 Passage des paramètres généraux * - FMWFILENAME : fichier Fmw diff --git a/src/module_gtf/gtf.engine/gtf.engines/engine.php b/src/module_gtf/gtf.engine/gtf.engines/engine.php index 70a33d3367b59ef821e172a0f9b9d13d36d9ef03..8b7877f89cf3d60a803816e4fcc74521330390a7 100755 --- a/src/module_gtf/gtf.engine/gtf.engines/engine.php +++ b/src/module_gtf/gtf.engine/gtf.engines/engine.php @@ -675,15 +675,14 @@ if ($ErrorLicense == "0") { ///* //Mise a jour de la demande si resultat null - /* $aParams = array(); - $aParams['iOrderId'] = array('value' => $aDemande['order_id'], 'type' => 'number'); - $aParams['sSchemaGtf'] = array('value' => $properties["schema_gtf"], 'type' => 'schema_name'); + $aParams['iUserId'] = array('value' => $aDemande['user_id'], 'type' => 'number'); + $aParams['sSchemaFramework'] = array('value' => $properties["schema_framework"], 'type' => 'schema_name'); $oPDOResult2 = $oBd->executeWithParams($aSql[$properties["sgbd"]]["update_demande_resultat_null"], $aParams); + //*/ if ($oBd->erreurRencontree) { writeToLog(INFO_GET_USER_INFO_ERROR . $aDemande['user_id'] . ". (SQL = " . $sSql . ")", $properties["engine_log_file"]); } else { - */ // $aUser = $oBd->ligneSuivante ($oPDOResult2); // $sContenuMail = "Bonjour ".$aUser["name"].",<br><br><br>".$sContenuMail; // $sContenuMail .= "<br><br><cite><h6>Cet e-mail a été envoyé par un robot, merci de ne pas répondre.</h6></cite><br>"; @@ -730,7 +729,7 @@ if ($ErrorLicense == "0") { $oEmail = new Email($oBd, $iEmailTemplateId, $properties, $aObjects); if (!empty($oEmail->oEmailTemplate->name)) $oEmail->send(); - //} + } $oPDOResult2 = $oBd->fermeResultat(); } else { // pas d'envoi de mail diff --git a/src/module_gtf/gtf.engine/gtf.engines/string.inc b/src/module_gtf/gtf.engine/gtf.engines/string.inc index 24e8c0e4dad3153051f23879cd9a3c5e5e9c66b4..26ffca304f8d99f30136f889c18a8ec11f367835 100755 --- a/src/module_gtf/gtf.engine/gtf.engines/string.inc +++ b/src/module_gtf/gtf.engine/gtf.engines/string.inc @@ -39,8 +39,6 @@ define('INFO_GTF_HOME', '|INFORM|PHP| GTF_HOME='); define('INFO_FME_PATH', '|INFORM|PHP| FME_PATH='); define('INFO_TREATMENT_COMMAND_LINE', '|INFORM|PHP| Ligne de commande exécutant le traitement : '); - define('INFO_NO_USE_PATTERN', '|INFORM|PHP| Utilisation des noms de fichier, sans utilisation des motifs'); - define('INFO_USE_PATTERN', '|INFORM|PHP| Utilisation des motifs '); // engine.php define('INFO_BASE_CONNECTION', '|INFORM|PHP| Connexion à la base de données '); diff --git a/src/module_gtf/module/javascript/script_module.js b/src/module_gtf/module/javascript/script_module.js index 0aae7bb9c4ed4bc4c2a06a47cf0fc017c54dc5a4..f96c62a49a65d4e976a00d9184e0bdda7b240ad1 100755 --- a/src/module_gtf/module/javascript/script_module.js +++ b/src/module_gtf/module/javascript/script_module.js @@ -95,7 +95,6 @@ vitisApp.on('appMainDrtvLoaded', function () { var $timeout = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$timeout"]); var $templateRequest = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$templateRequest"]); var $compile = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$compile"]); - var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); var envSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["envSrvc"]); var externFunctionSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["externFunctionSrvc"]); var modesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["modesSrvc"]); @@ -108,14 +107,14 @@ vitisApp.on('appMainDrtvLoaded', function () { // Mise à jour de l'état des demandes. $scope["refreshSupervisionRecap"](); // Actualisation de la barre de recap des demandes, abonnements, surveillances à chaque chargement ou raffraîchissement de la liste. - $rootScope["gridApi"][$scope["sSelectedGridOptionsName"]]["grid"]["options"]["appBeforeEvent"] = "refreshSupervisionRecap()"; + $scope.$root["gridApi"][$scope["sSelectedGridOptionsName"]]["grid"]["options"]["appBeforeEvent"] = "refreshSupervisionRecap()"; // Compile le template du récap. de la supervision. $timeout(function () { var sTemplateUrl = 'modules/gtf/templates/supervisionStatusTpl.html'; $templateRequest(sTemplateUrl).then(function (sTemplate) { $compile($("#" + envSrvc["oSelectedObject"]["name"] + "_" + envSrvc["sSelectedSectionName"] + "_grid_header_option_bar").html(sTemplate).contents())($scope); // Attends le raffraîchissement du statut de la supervision. - var clearListener = $rootScope.$on('supervisionRecapRefreshed', function (event) { + var clearListener = $scope.$root.$on('supervisionRecapRefreshed', function (event) { // Supprime le "listener". clearListener(); // Attends la fin du $digest(). @@ -123,7 +122,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // Redimensionne la fenêtre principale de l'application. externFunctionSrvc["resizeWin"](); // Redimensionne la liste (ui-grid). - $rootScope["gridApi"][$scope["sSelectedGridOptionsName"]]["core"]["handleWindowResize"](); + $scope.$root["gridApi"][$scope["sSelectedGridOptionsName"]]["core"]["handleWindowResize"](); }); }); }); diff --git a/src/module_gtf/web_service/class/gtf_lib/FmeCloud.class.inc b/src/module_gtf/web_service/class/gtf_lib/FmeCloud.class.inc index fc8eaec69cf47949e8f7546769d228bdd03dc839..2c6ba6120d1e0ead75c458772b7d195b1213cbbd 100755 --- a/src/module_gtf/web_service/class/gtf_lib/FmeCloud.class.inc +++ b/src/module_gtf/web_service/class/gtf_lib/FmeCloud.class.inc @@ -1,17 +1,9 @@ <?php require_once("vmlib/logUtil.inc"); -/** - * \file FmeCloud.php - * \brief Main class to use Fme Cloud services. - * - * \author Frederic Carretero <frederic.carretero@veremes.com> - */ - Class FmeCloud { public $sUrl; public $aLastCurlRequestInfo; - public $sLogFilePath; // Chemin optionnel vers le fichier de log pour Fme Cloud. private $sToken; /** @@ -112,18 +104,9 @@ Class FmeCloud { $sUrl = $this->sUrl; // Url vers le service d'information. $sUrl = $this->sUrl . '/v1/' . $sService; + echo $sUrl . PHP_EOL; // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, $sMethod, $aData); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->exception) && !empty($oRequestResponse->exception->message)) - $this->writeToErrorLog('|' . $sService . '|' . ' ' . $oRequestResponse->message); - else - $this->writeToErrorLog('|' . $sService . '|' . ' ' . $sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); + return json_decode($this->curlRequest($sUrl, $sMethod, $aData)); } /** @@ -136,18 +119,9 @@ Class FmeCloud { $sUrl = $this->sUrl; // Url vers le service d'information. $sUrl = $this->sUrl . '/v1/instances/' . $iId . '/start'; + echo $sUrl . PHP_EOL; // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, 'PUT'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->exception) && !empty($oRequestResponse->exception->message)) - $this->writeToErrorLog($oRequestResponse->exception->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); + return json_decode($this->curlRequest($sUrl, 'PUT')); } /** @@ -160,18 +134,9 @@ Class FmeCloud { $sUrl = $this->sUrl; // Url vers le service d'information. $sUrl = $this->sUrl . '/v1/instances/' . $iId . '/pause'; + echo $sUrl . PHP_EOL; // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, 'PUT'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->exception) && !empty($oRequestResponse->exception->message)) - $this->writeToErrorLog($oRequestResponse->exception->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); + return json_decode($this->curlRequest($sUrl, 'PUT')); } /** @@ -184,31 +149,9 @@ Class FmeCloud { $sUrl = $this->sUrl; // Url vers le service d'information. $sUrl = $this->sUrl . '/v1/instances/' . $iId . '/credentials'; + echo $sUrl . PHP_EOL; // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, 'GET'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->exception) && !empty($oRequestResponse->exception->message)) - $this->writeToErrorLog($oRequestResponse->exception->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); - } - - /** - * Write a message to the error log file. - * @param {string} $sMessage Message to write to the log file. - */ - function writeToErrorLog($sMessage) { - $aDebugBacktrace = debug_backtrace(); - $sLogMessage = '|ERROR|' . $aDebugBacktrace[1]['class'] . '::' . $aDebugBacktrace[1]['function'] . '| ' . $sMessage; - if (empty($this->sLogFilePath)) - writeToErrorLog($sLogMessage); - else - writeToLog($sLogMessage, $this->sLogFilePath); + return json_decode($this->curlRequest($sUrl, 'GET')); } } ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/class/gtf_lib/FmeCloudForGtf.class.inc b/src/module_gtf/web_service/class/gtf_lib/FmeCloudForGtf.class.inc index b0f5a1ebb7f52a6cfdd923bc3daf8198d562c572..da2e8793f716a5d4c1c4ad2c74ee7b098e020c98 100755 --- a/src/module_gtf/web_service/class/gtf_lib/FmeCloudForGtf.class.inc +++ b/src/module_gtf/web_service/class/gtf_lib/FmeCloudForGtf.class.inc @@ -1,5 +1,5 @@ <?php -require 'aws_lib/AmazonApiGateway.class.inc'; +require 'gtf_lib/AmazonApiGateway.class.inc'; Class FmeCloudForGtf extends AmazonApiGateway { public $sGtfInstanceId; // Id de l'instance de GTF. diff --git a/src/module_gtf/web_service/class/gtf_lib/FmeServer.class.inc b/src/module_gtf/web_service/class/gtf_lib/FmeServer.class.inc old mode 100644 new mode 100755 index dd4833959835e24ca48b5d0030a4cd34d1643660..e05b1bf7101d0d58a99f2f6bb804164e7183e627 --- a/src/module_gtf/web_service/class/gtf_lib/FmeServer.class.inc +++ b/src/module_gtf/web_service/class/gtf_lib/FmeServer.class.inc @@ -1,25 +1,11 @@ <?php require_once("vmlib/logUtil.inc"); -/** - * \file FmeServer.php - * \brief Main class to use Fme Server services. - * - * \author Frederic Carretero <frederic.carretero@veremes.com> - */ - Class FmeServer { - const CURL_CONNECTION_TIMEOUT = 0; - const CURL_TIMEOUT = 360; - const INFO_FME_SERVER_JOB_CANCELED = '|INFORM|PHP| Le traitement a été annulé sur Fme Server'; - const INFO_FME_SERVER_JOB_STOPPED = '|INFORM|PHP| Le traitement a été arrêté sur Fme Server'; - const INFO_FME_SERVER_JOB_REMOVED = '|INFORM|PHP| Le traitement a été supprimé sur Fme Server'; - public $sUrl; public $sTimeUnit; public $iExpiration; public $aLastCurlRequestInfo; - public $sLogFilePath; // Chemin optionnel vers le fichier de log pour Fme Server. private $sUser; private $sPassword; private $sToken; @@ -60,13 +46,7 @@ Class FmeServer { 'update' => $this->bUpdate ); // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, 'post', $aRequestData); - if ($this->aLastCurlRequestInfo['http_code'] != 200) { - $this->writeToErrorLog($sRequestResponse); - $this->sToken = false; - } - else - $this->sToken = $sRequestResponse; + $this->sToken = $this->curlRequest($sUrl, 'post', $aRequestData); return $this->sToken; } @@ -111,10 +91,8 @@ Class FmeServer { if (!empty($this->sToken)) $aHeaders[] = 'Authorization: fmetoken token=' . $this->sToken; // Token obligatoire pour éxécuter la requête. curl_setopt($ch, CURLOPT_HTTPHEADER, $aHeaders); - // Le nombre de secondes à attendre durant la tentative de connexion. - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::CURL_CONNECTION_TIMEOUT); - // Le temps maximum d'exécution de la fonction cURL (secondes). - curl_setopt($ch, CURLOPT_TIMEOUT, self::CURL_TIMEOUT); + // Durée max. de la requête. + //curl_setopt($ch, CURLOPT_TIMEOUT, 120); // Exécute la session CURL. // Log. /* @@ -126,16 +104,13 @@ Class FmeServer { curl_setopt($ch, CURLINFO_HEADER_OUT, true); // Curl error: SSL certificate problem: unable to get local issuer certificate // Curl error n°60 - curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); - // Curl error: SSL: no alternative certificate subject name matches target host name '52.205.208.184' (si utilisation de l'adresse ip et non ) - // Curl error n°51 - curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); // $output = curl_exec($ch); // Erreur de la requête CURL. if(curl_errno($ch)) { - $this->writeToErrorLog('Curl error: ' . curl_error($ch)); - $this->writeToErrorLog('Curl error n°' . curl_errno($ch)); + writeToErrorLog('Curl error: ' . curl_error($ch)); + writeToErrorLog('Curl error n°' . curl_errno($ch)); } // Informations de la requête. $aCurlInfo = curl_getinfo($ch); @@ -158,78 +133,42 @@ Class FmeServer { * @param {array} $aData Data of the Curl request. * @return Request result */ - function serviceRequest($sService, $sMethod = 'get', $aData = array(), $bWriteToErrorLog = true) { + function serviceRequest($sService, $sMethod = 'get', $aData = array()) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url vers le serveur fme. - $sUrl = $this->sUrl; - // Url vers le service d'information. - $sUrl = $this->sUrl . '/fmerest/v3/' . $sService; - // Transfert cURL - $sRequestResponse = $this->curlRequest($sUrl, $sMethod, $aData); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - if ($bWriteToErrorLog) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog('|' . $sService . '|' . ' ' . $oRequestResponse->message); - else - $this->writeToErrorLog('|' . $sService . '|' . ' ' . $sRequestResponse); - } - return false; - } - else - return json_decode($sRequestResponse); - } - else - return false; + // Url vers le serveur fme. + $sUrl = $this->sUrl; + // Url vers le service d'information. + $sUrl = $this->sUrl . '/fmerest/v3/' . $sService; + // Transfert cURL + return json_decode($this->curlRequest($sUrl, $sMethod, $aData)); } /** * Upload a file * @param {string} $sFilePath Path of the file to upload. * @param {string} $sServiceUrl Url of the web service to upload the file. - * @param {string} $sFileName Name of the created file. * @return Request result */ - function uploadFile($sServiceUrl, $sFilePath, $sFileName = '') { + function uploadFile($sServiceUrl, $sFilePath) { if (file_exists($sFilePath)) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Nom du fichier. - if (empty($sFileName)) - $sFileName = pathinfo($sFilePath, PATHINFO_BASENAME); - // Type MIME du fichier. - //$finfo = finfo_open(FILEINFO_MIME_TYPE); - // Crée un objet CURLFile. - //$oCfile = new CURLFile($sFilePath, finfo_file($finfo, $sFilePath), $sFileName); - //finfo_close($finfo); - // Entêtes de la requête Curl. - $aRequestHeaders = array( - 'Content-Type: application/octet-stream', - 'Content-Disposition: attachment; filename="' . $sFileName . '"', - //'Content-Length: ' . filesize($sFilePath) - ); - // - $sRequestResponse = $this->curlRequest($sServiceUrl, 'post', file_get_contents($sFilePath), $aRequestHeaders); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog($oRequestResponse->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); - } - else - return false; - } - else { - $this->writeToErrorLog('The file does not exist (' . $sFilePath . ')'); - return false; + // Nom du fichier. + $sFileName = pathinfo($sFilePath, PATHINFO_BASENAME); + // Type MIME du fichier. + //$finfo = finfo_open(FILEINFO_MIME_TYPE); + // Crée un objet CURLFile. + //$oCfile = new CURLFile($sFilePath, finfo_file($finfo, $sFilePath), $sFileName); + //finfo_close($finfo); + // Entêtes de la requête Curl. + $aRequestHeaders = array( + 'Content-Type: application/octet-stream', + 'Content-Disposition: attachment; filename="' . $sFileName . '"', + //'Content-Length: ' . filesize($sFilePath) + ); + // + return json_decode($this->curlRequest($sServiceUrl, 'post', file_get_contents($sFilePath), $aRequestHeaders)); } } @@ -245,94 +184,32 @@ Class FmeServer { function uploadResourceFile($sFilePath, $sResource, $sPath, $bCreateDirectories = false, $bOverwrite = false) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du service de ressources. - $sUrl = $this->sUrl . '/fmerest/v3/resources/connections/' . $sResource . '/filesys/' . $sPath; - $sUrl .= '?createDirectories=' . var_export($bCreateDirectories, true) . '&overwrite=' . var_export($bOverwrite, true); - return $this->uploadFile($sUrl, $sFilePath); - } - else - return false; + // Url du service de ressources. + $sUrl = $this->sUrl . '/fmerest/v3/resources/connections/' . $sResource . '/filesys/' . $sPath; + $sUrl .= '?createDirectories=' . var_export($bCreateDirectories, true) . '&overwrite=' . var_export($bOverwrite, true); + return $this->uploadFile($sUrl, $sFilePath); } /** - * Publish a file to a repository - * @param {string} $sFilePath Path of the file to upload. - * @param {string} $sRepository Name of the repository. - * @param {boolean} $bOverwrite Overwrite the file if it already exists. - * @param {string} $sRepositoryFileName File name in the repository. - * @return Request result - */ - function uploadWorkspaceFile($sFilePath, $sRepository, $bOverwrite = false, $sRepositoryFileName = '') { - // Demande de token. - $this->getToken(); - if ($this->sToken !== false) { - // Vérification de l'existence du fichier. - $bUploadFile = true; - if (!empty($sRepositoryFileName)) - $sSourceFileName = $sRepositoryFileName; - else - $sSourceFileName = pathinfo($sFilePath, PATHINFO_BASENAME); - $this->serviceRequest('repositories/' . $sRepository . '/items/' . $sSourceFileName, 'get', null, false); - // Supprime le fichier s'il existe déja. - if ($this->aLastCurlRequestInfo['http_code'] == 200) { - if ($bOverwrite) { - if ($this->serviceRequest('repositories/' . $sRepository . '/items/' . $sSourceFileName, 'delete') === false) - return false; - } - else - $bUploadFile = false; - } - //Upload du fichier. - if ($bUploadFile) { - $sUrl = $this->sUrl . '/fmerest/v3/repositories/' . $sRepository . '/items'; - return $this->uploadFile($sUrl, $sFilePath, $sRepositoryFileName); - } - } - else - return false; - } - - /** - * Upload a resource to a repository item + * Upload a file to the resource connection * @param {string} $sFilePath Path of the file to upload. * @param {string} $sRepository Name of the repository. - * @param {string} $sItem Name of the repository item. * @param {boolean} $bOverwrite Overwrite the file if it already exists. * @return Request result */ - function uploadWorkspaceResourceFile($sFilePath, $sRepository, $sItem, $bOverwrite = false) { + function uploadWorkspaceFile($sFilePath, $sRepository, $bOverwrite = false) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - $bUploadFile = true; + // Supprime le fichier s'il existe déja. + if ($bOverwrite) { $sFileName = pathinfo($sFilePath, PATHINFO_BASENAME); - // Télécharge la liste des ressources complémentaires du projet. - $aResources = $this->serviceRequest('repositories/' . $sRepository . '/items/' . $sItem . '/resources', 'get'); - if ($aResources !== false) { - // Vérification de l'existence du fichier. - foreach ($aResources as $oResource) { - // Supprime le fichier s'il existe déja. - if ($oResource->name == $sFileName) { - if ($bOverwrite) { - if ($this->serviceRequest('repositories/' . $sRepository . '/items/' . $sItem . '/resources/' . $sFileName, 'delete') === false) - return false; - } - else - $bUploadFile = false; - } - } - } - else - return false; - // Upload du fichier. - if ($bUploadFile) { - $sUrl = $this->sUrl . '/fmerest/v3/repositories/' . $sRepository . '/items/' . $sItem . '/resources'; - return $this->uploadFile($sUrl, $sFilePath); - } + $this->serviceRequest('repositories/' . $sRepository . '/items/' . $sFileName); + if ($this->aLastCurlRequestInfo['http_code'] == 200) + $this->serviceRequest('repositories/' . $sRepository . '/items/' . $sFileName, 'delete'); } - else - return false; + // Url du service vers le dépôt spécifié. + $sUrl = $this->sUrl . '/fmerest/v3/repositories/' . $sRepository . '/items'; + return $this->uploadFile($sUrl, $sFilePath); } /** @@ -344,25 +221,10 @@ Class FmeServer { function getWorkspaceParams($sRepository, $sWorkspace) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du service vers le traitement (fichier.fmw) spécifié. - $sUrl = $this->sUrl . '/fmerest/v3/repositories/' . $sRepository . '/items/' . $sWorkspace; - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'get'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog($oRequestResponse->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); - - } - else - return false; + // Url du service vers le traitement (fichier.fmw) spécifié. + $sUrl = $this->sUrl . '/fmerest/v3/repositories/' . $sRepository . '/items/' . $sWorkspace; + // Transfert cURL. + return json_decode($this->curlRequest($sUrl, 'get')); } /** @@ -376,33 +238,15 @@ Class FmeServer { function submitJob($sRepository, $sWorkspace, $aParams, $bAsync = false) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du service vers le traitement (fichier.fmw) spécifié. - if ($bAsync) - $sUrl = $this->sUrl . '/fmerest/v3/transformations/submit/' . $sRepository . '/' . $sWorkspace; - else - $sUrl = $this->sUrl . '/fmerest/v3/transformations/transact/' . $sRepository . '/' . $sWorkspace; - // Données au format json. - $aHeaders = array('Content-Type: application/json'); - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'post', json_encode($aParams), $aHeaders); - $oRequestResponse = json_decode($sRequestResponse); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - if (is_object($oRequestResponse)) { - if (empty($oRequestResponse->id)) { - $this->writeToErrorLog($oRequestResponse->message); - return false; - } - else - $this->writeToErrorLog($oRequestResponse->statusMessage); - } - else - $this->writeToErrorLog($sRequestResponse); - } - return $oRequestResponse; - } + // Url du service vers le traitement (fichier.fmw) spécifié. + if ($bAsync) + $sUrl = $this->sUrl . '/fmerest/v3/transformations/submit/' . $sRepository . '/' . $sWorkspace; else - return false; + $sUrl = $this->sUrl . '/fmerest/v3/transformations/transact/' . $sRepository . '/' . $sWorkspace; + // Données au format json. + $aHeaders = array('Content-Type: application/json'); + // Transfert cURL. + return json_decode($this->curlRequest($sUrl, 'post', json_encode($aParams), $aHeaders)); } /** @@ -415,37 +259,23 @@ Class FmeServer { function downloadResourceFile($sResource, $sPath, $sFilePath = null) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du service vers le traitement (fichier.fmw) spécifié. - $sUrl = $this->sUrl . '/fmerest/v3/resources/connections/' . $sResource . '/filesys/' . $sPath; - // Obligatoire pour récupérer le contenu du fichier. - $aHeaders = array('Accept: application/octet-stream'); - // Données de la requête. - /* - $aRequestData = array ( - 'accept' => 'contents', - 'disposition' => 'inline' - ); - */ - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'get', null, $aHeaders); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog($oRequestResponse->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else { - if (!empty($sFilePath)) - file_put_contents($sFilePath, $sRequestResponse); - else - return $sRequestResponse; - } - } + // Url du service vers le traitement (fichier.fmw) spécifié. + $sUrl = $this->sUrl . '/fmerest/v3/resources/connections/' . $sResource . '/filesys/' . $sPath; + // Obligatoire pour récupérer le contenu du fichier. + $aHeaders = array('Accept: application/octet-stream'); + // Données de la requête. + /* + $aRequestData = array ( + 'accept' => 'contents', + 'disposition' => 'inline' + ); + */ + // Transfert cURL. + $sFileContent = $this->curlRequest($sUrl, 'get', null, $aHeaders); + if (!empty($sFilePath)) + file_put_contents($sFilePath, $sFileContent); else - return false; + return $sFileContent; } /** @@ -456,30 +286,16 @@ Class FmeServer { function getJobLog($sJobId, $sFilePath = '') { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du service vers le traitement (fichier.fmw) spécifié. - $sUrl = $this->sUrl . '/fmerest/v3/transformations/jobs/id/' . $sJobId . '/log'; - // Obligatoire pour récupérer le contenu du fichier. - $aHeaders = array('Accept: text/plain'); - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'get', null, $aHeaders); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog($oRequestResponse->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else { - if (!empty($sFilePath)) - file_put_contents($sFilePath, $sRequestResponse); - else - return $sRequestResponse; - } - } + // Url du service vers le traitement (fichier.fmw) spécifié. + $sUrl = $this->sUrl . '/fmerest/v3/transformations/jobs/id/' . $sJobId . '/log'; + // Obligatoire pour récupérer le contenu du fichier. + $aHeaders = array('Accept: text/plain'); + // Transfert cURL. + $sFileContent = $this->curlRequest($sUrl, 'get', null, $aHeaders); + if (!empty($sFilePath)) + file_put_contents($sFilePath, $sFileContent); else - return false; + return $sFileContent; } /** @@ -491,20 +307,16 @@ Class FmeServer { function createRepository($sRepository, $sDescription) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Crée le dépot s'il n'existe pas déja. - $aRequestResult = $this->serviceRequest('repositories/' . $sRepository, 'get', null, false); - if ($this->aLastCurlRequestInfo['http_code'] == 404) { - $aRequestData = array ( - 'name' => $sRepository, - 'description' => $sDescription - ); - $aRequestResult = $this->serviceRequest('repositories', 'post', $aRequestData); - } - return $aRequestResult; + // Crée le dépot s'il n'existe pas déja. + $aRequestResult = $this->serviceRequest('repositories/' . $sRepository); + if ($this->aLastCurlRequestInfo['http_code'] == 404) { + $aRequestData = array ( + 'name' => $sRepository, + 'description' => $sDescription + ); + $aRequestResult = $this->serviceRequest('repositories', 'post', $aRequestData); } - else - return false; + return $aRequestResult; } /** @@ -518,22 +330,18 @@ Class FmeServer { function uploadResourceFileFromS3($aS3Params, $sRepository, $sResource, $sPath) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // - $aJobParams = array( - 'publishedParameters' => array( - array('name' => 'access_key_id', 'value' => $aS3Params['access_key_id']), - array('name' => 'secret_access_key', 'value' => $aS3Params['secret_access_key']), - array('name' => 'bucket_name', 'value' => $aS3Params['bucket_name']), - array('name' => 'object_key', 'value' => $aS3Params['object_key']), - array('name' => 'target_file', 'value' => '$(' . $sResource . ')/' . $sPath . '/' . pathinfo($aS3Params['object_key'], PATHINFO_BASENAME)) - ) - ); - $oJobResult = $this->submitJob($sRepository, 'S3Downloader.fmw', $aJobParams); - return $oJobResult; - } - else - return false; + // + $aJobParams = array( + 'publishedParameters' => array( + array('name' => 'access_key_id', 'value' => $aS3Params['access_key_id']), + array('name' => 'secret_access_key', 'value' => $aS3Params['secret_access_key']), + array('name' => 'bucket_name', 'value' => $aS3Params['bucket_name']), + array('name' => 'object_key', 'value' => $aS3Params['object_key']), + array('name' => 'target_file', 'value' => '$(' . $sResource . ')/' . $sPath . '/' . pathinfo($aS3Params['object_key'], PATHINFO_BASENAME)) + ) + ); + $oJobResult = $this->submitJob($sRepository, 'S3Downloader.fmw', $aJobParams); + return $oJobResult; } /** @@ -546,19 +354,15 @@ Class FmeServer { function createResourceConnectionDirectory($sResource, $sPath, $DirectoryName) { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Crée le répertoire s'il n'existe pas déja. - $aRequestResult = $this->serviceRequest('resources/connections/' . $sResource . '/filesys/' . $sPath . '/' . $DirectoryName, 'get', null, false); - if ($this->aLastCurlRequestInfo['http_code'] == 404) { - $aRequestData = array ( - 'directoryname' => $DirectoryName - ); - $aRequestResult = $this->serviceRequest('resources/connections/' . $sResource . '/filesys/' . $sPath, 'post', $aRequestData); - } - return $aRequestResult; + // Crée le répertoire s'il n'existe pas déja. + $aRequestResult = $this->serviceRequest('resources/connections/' . $sResource . '/filesys/' . $sPath . '/' . $DirectoryName); + if ($this->aLastCurlRequestInfo['http_code'] == 404) { + $aRequestData = array ( + 'directoryname' => $DirectoryName + ); + $aRequestResult = $this->serviceRequest('resources/connections/' . $sResource . '/filesys/' . $sPath, 'post', $aRequestData); } - else - return false; + return $aRequestResult; } /** @@ -568,24 +372,10 @@ Class FmeServer { function getInfo() { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du web service info. - $sUrl = $this->sUrl . '/fmerest/v3/info'; - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'get'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $oRequestResponse = json_decode($sRequestResponse); - if (is_object($oRequestResponse) && !empty($oRequestResponse->message)) - $this->writeToErrorLog($oRequestResponse->message); - else - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); - } - else - return false; + // Url du web service info. + $sUrl = $this->sUrl . '/fmerest/v3/info'; + // Transfert cURL. + return json_decode($this->curlRequest($sUrl, 'get')); } /** @@ -595,106 +385,10 @@ Class FmeServer { function getLicenceStatus() { // Demande de token. $this->getToken(); - if ($this->sToken !== false) { - // Url du web service info. - $sUrl = $this->sUrl . '/fmerest/v3/licensing/license/status'; - // Transfert cURL. - $sRequestResponse = $this->curlRequest($sUrl, 'get'); - if ($this->aLastCurlRequestInfo['http_code'] >= 400) { - $this->writeToErrorLog($sRequestResponse); - return false; - } - else - return json_decode($sRequestResponse); - } - else - return false; - } - - /** - * Write a message to the error log file. - * @param {string} $sMessage Message to write to the log file. - */ - function writeToErrorLog($sMessage) { - $aDebugBacktrace = debug_backtrace(); - $sLogMessage = '|ERROR|' . $aDebugBacktrace[1]['class'] . '::' . $aDebugBacktrace[1]['function'] . '| ' . $sMessage; - if (empty($this->sLogFilePath)) - writeToErrorLog($sLogMessage); - else - writeToLog($sLogMessage, $this->sLogFilePath); - } - - /** - * Delete a job. - * @param {number} $iJobId The id of the job. - * @return Request result - */ - function deleteJob($iJobId) { - // Demande de token. - $this->getToken(); - if ($this->sToken !== false) { - // Annule une demande en attente ou arrête une demande en cours. - if ($this->stopJob($iJobId) !== false) { - // Supprime définitivement la demande sur Fme Server. - if ($this->serviceRequest('transformations/jobs/completed/' . $iJobId, 'delete') !== false) - writeToLog(self::INFO_FME_SERVER_JOB_REMOVED . " (job id $iJobId).", $this->sLogFilePath); - else - return false; - } - } - else - return false; - } - - /** - * Cancel a queued job. - * @param {number} $iJobId The id of the job. - * @return Request result - */ - function cancelJob($iJobId) { - // Demande de token. - $this->getToken(); - if ($this->sToken !== false) { - // Annule le traitement. - if ($this->serviceRequest('transformations/jobs/queued/' . $iJobId, 'delete') !== false) - writeToLog(self::INFO_FME_SERVER_JOB_CANCELED . " (job id $iJobId).", $this->sLogFilePath); - else - return false; - } - else - return false; - } - - /** - * Stop a queued or running job. - * @param {number} $iJobId The id of the job. - * @return Request result - */ - function stopJob($iJobId) { - // Demande de token. - $this->getToken(); - if ($this->sToken !== false) { - $oJobLog = $this->serviceRequest('transformations/jobs/id/' . $iJobId); - if ($oJobLog !== false) { - // Annule une demande en attente ou arrête une demande en cours. - $aQueuedStatus = array('SUBMITTED', 'QUEUED', 'DELAYED', 'PAUSED'); - $aRunningStatus = array('IN_PROCESS', 'PULLED'); - $aStoppedStatus = array('DELETED', 'ABORTED', 'FME_FAILURE', 'JOB_FAILURE', 'SUCCESS'); - if (in_array($oJobLog->status, $aQueuedStatus)) - $this->cancelJob($iJobId); - else if (!in_array($oJobLog->status, $aStoppedStatus)){ - // Annule le traitement. - if ($this->serviceRequest('transformations/jobs/running/' . $iJobId, 'delete') !== false) - writeToLog(self::INFO_FME_SERVER_JOB_STOPPED . " (job id $iJobId).", $this->sLogFilePath); - else - return false; - } - } - else - return false; - } - else - return false; + // Url du web service info. + $sUrl = $this->sUrl . '/fmerest/v3/licensing/license/status'; + // Transfert cURL. + return json_decode($this->curlRequest($sUrl, 'get')); } } ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/Category.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/Category.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/FmeEngine.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/FmeEngine.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/GtfEngine.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/GtfEngine.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/Order.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/Order.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/User.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/User.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/gtf_object/Workspace.class.inc b/src/module_gtf/web_service/class/gtf_lib/gtf_object/Workspace.class.inc old mode 100644 new mode 100755 diff --git a/src/module_gtf/web_service/class/gtf_lib/imap_reader/ImapConnection.php b/src/module_gtf/web_service/class/gtf_lib/imap_reader/ImapConnection.php old mode 100755 new mode 100644 diff --git a/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailBox.php b/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailBox.php old mode 100755 new mode 100644 diff --git a/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailStruct.php b/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailStruct.php old mode 100755 new mode 100644 index b45ce29d6e78e921d5dfac475ad4a2e27721285b..5f79b22e8e3a2e9554d794d9d8f074b9ec73136e --- a/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailStruct.php +++ b/src/module_gtf/web_service/class/gtf_lib/imap_reader/MailStruct.php @@ -100,20 +100,13 @@ class MailStruct { foreach ($aPart as $oPart) { if ($oPart["part_object"]->encoding == 3 || $oPart["part_object"]->encoding == 4) { $sMimeType = $this->oConnection->getMimeType($oPart["part_object"]); - - //$this->sBody = $this->oConnection->getPart($this->iUid, $oPart["part_object"]->encoding, $oPart["part_number"]); - if ($sMimeType === "TEXT/HTML") { - //error_log(print_r($oPart, true)); - $this->sBody = $this->convertToUtf8($this->oConnection->getPart($this->iUid, $oPart["part_object"]->encoding, $oPart["part_number"])); + $this->sBody = $this->oConnection->getPart($this->iUid, $oPart["part_object"]->encoding, $oPart["part_number"]); $this->bIsHTML = true; } else if($sMimeType === "TEXT/PLAIN"){ - //error_log(print_r($oPart, true)); - $this->sBody = $this->convertToUtf8($this->oConnection->getPart($this->iUid, $oPart["part_object"]->encoding, $oPart["part_number"])); + $this->sBody = $this->oConnection->getPart($this->iUid, $oPart["part_object"]->encoding, $oPart["part_number"]); $this->bIsHTML = false; } - //error_log($this->sBody); - //error_log(mb_detect_encoding($this->sBody)); } } } diff --git a/src/module_gtf/web_service/class/gtf_lib/phpUtility.inc b/src/module_gtf/web_service/class/gtf_lib/phpUtility.inc index e44481c94444ba704185eb73232075a7013a2a96..13f6f5ce3071cc411b816b67e5d0902521d29d88 100755 --- a/src/module_gtf/web_service/class/gtf_lib/phpUtility.inc +++ b/src/module_gtf/web_service/class/gtf_lib/phpUtility.inc @@ -292,39 +292,4 @@ function getFmeLicence($fmepath) function array_iunique($aArray){ return array_intersect_key($aArray, array_unique(array_map("StrToLower",$aArray))); } - -/** - * Generate a GTF instance id. - * @return GTF instance id - */ -function generateGtfInstanceId() { - $aOutput = array(); - $iReturnStatus = 1; - if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { - // Paramètres à concaténer pour un identifiant unique par machine. - $aCommands = array( - 'NICCONFIG', // cartes réseaux (adresses MAC) - 'CPU', // modèle, vitesse, id... - 'DISKDRIVE', // N° de série... - 'MEMORYCHIP', - 'CDROM', // Lecteur DVD... - 'path win32_VideoController', // Carte vidéo - 'IDECONTROLLER', - 'SCSICONTROLLER', - 'DESKTOPMONITOR', - 'LOGON', - 'NETLOGIN' - ); - $sCommandLine = 'wmic '. implode(' & wmic ', $aCommands); - exec($sCommandLine, $aOutput, $iReturnStatus); - } - else if (strtolower(substr(PHP_OS, 0, 5)) == 'linux') { - $aLinuxCommand = array('lscpu', 'lspci', 'df', 'free', 'ip a', 'cat /var/lib/dbus/machine-id'); // , 'sudo cat /sys/class/dmi/id/product_uuid' - foreach ($aLinuxCommand as $sCommand) { - exec($sCommand, $aOutput, $iReturnStatus); - } - $aOutput['ses_Login'] = $_SESSION['ses_Login']; - } - return 'GTF_' . hash_hmac('sha256', implode(chr(20), $aOutput), uniqid('', true)); -} ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/conf/properties.inc b/src/module_gtf/web_service/conf/properties.inc old mode 100644 new mode 100755 index ff978e12472d7f8c64c66b723ca595c89a72a409..e24cac584152a12744f069552c2ebf5a1be2bcdc --- a/src/module_gtf/web_service/conf/properties.inc +++ b/src/module_gtf/web_service/conf/properties.inc @@ -6,6 +6,4 @@ $properties['heure_creuse_min'] = '19:30'; $properties['heure_creuse_max'] = '08:30'; $properties['nbr_order_max'] = 10; $properties['max_attempt'] = 2; -$properties['connectionStringExternalIp'] = '52.47.201.61'; -$properties['connectionStringExternalPort'] = 5432; ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/conf/properties_server.inc b/src/module_gtf/web_service/conf/properties_server.inc index 6ff1a41eed1f2e7b166ee0e65e3f35adf22057d4..87791cf6bfa5efe4f8825d3351340d65c7b67f44 100755 --- a/src/module_gtf/web_service/conf/properties_server.inc +++ b/src/module_gtf/web_service/conf/properties_server.inc @@ -3,5 +3,4 @@ $properties['schema_gtf'] = 's_gtf'; $properties['gtf_doc_alias'] = 'gtf_doc'; $properties['login_scheduler'] = 'u_scheduler'; $properties['password_scheduler'] = '[PASSWORD_SCHEDULER]'; -$properties['application_name'] = 'gtf[ENV]'; ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/conf/selected_properties.inc b/src/module_gtf/web_service/conf/selected_properties.inc old mode 100644 new mode 100755 index 8f07f5c1cc500f18b2636677eb4852f9566cd201..9de194fdb67670e71ea3201417dc1905372cfc94 --- a/src/module_gtf/web_service/conf/selected_properties.inc +++ b/src/module_gtf/web_service/conf/selected_properties.inc @@ -15,12 +15,7 @@ $aAdminFields = Array( 'pycron_dir', 'login_scheduler', 'password_scheduler', - 'gtf_doc_alias', - 'application_name', - 'fme_cloud_api_url', - 'gtf_instance_id', - 'connectionStringExternalIp', - 'connectionStringExternalPort' + 'gtf_doc_alias' ); $aUserFields = Array( 'schema_gtf', @@ -37,14 +32,9 @@ $aUserFields = Array( 'pycron_dir', 'login_scheduler', 'password_scheduler', - 'gtf_doc_alias', - 'application_name', - 'fme_cloud_api_url', - 'gtf_instance_id', - 'connectionStringExternalIp', - 'connectionStringExternalPort' + 'gtf_doc_alias' ); $properties['aAdminFields'] = array_merge($properties['aAdminFields'], $aAdminFields); $properties['aUserFields'] = array_merge($properties['aUserFields'], $aUserFields); -?> +?> \ No newline at end of file diff --git a/src/module_gtf/web_service/sql/maj.sql b/src/module_gtf/web_service/sql/maj.sql old mode 100644 new mode 100755 index 1ed5dac181c65c219db0d7fc2c986d24f345e8c7..f24bccb780f8d7fc689e0fdaed7712cc8eb8da72 --- a/src/module_gtf/web_service/sql/maj.sql +++ b/src/module_gtf/web_service/sql/maj.sql @@ -71,10 +71,4 @@ INSERT INTO s_vitis.vm_table_field (table_field_id, name, sortable, resizeable, -- Libellé du champ "type" de moteur FME. UPDATE s_vitis.vm_tab SET event = 'loadList(null, {"lang": ""})' WHERE name ='gtf_fme_engine'; -- -UPDATE s_vitis.vm_table_field SET width = 200 WHERE label_id = 'gtf_128'; - --- Anthony le 18/09/2018 14:43 -ALTER TABLE s_gtf.fme_engine ADD COLUMN useexternaldbconnection boolean DEFAULT FALSE; -CREATE OR REPLACE VIEW s_gtf.v_fme_engine AS SELECT fme_engine.fme_engine_id, fme_engine.name, fme_engine.server_id, fme_engine.local_path, server.hostname AS server_name, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_engine_type_id, fme_engine.s3_access_key_id, fme_engine.s3_secret_access_key, fme_engine.fme_cloud_api_token, v_fme_engine_type.fme_engine_type_label, v_fme_engine_type.lang, fme_engine.s3_region, fme_engine.iam_access_key_id, fme_engine.iam_secret_access_key, fme_engine.fme_server_instance_name, fme_engine.fme_server_s3_bucket, useexternaldbconnection FROM s_gtf.fme_engine LEFT JOIN s_gtf.server ON fme_engine.server_id = server.server_id LEFT JOIN s_gtf.v_fme_engine_type ON fme_engine.fme_engine_type_id::text = v_fme_engine_type.fme_engine_type_id::text; -CREATE OR REPLACE RULE insert_v_fme_engine AS ON INSERT TO s_gtf.v_fme_engine DO INSTEAD INSERT INTO s_gtf.fme_engine (fme_engine_id, name, server_id, local_path, server_url, login, password, fme_engine_type_id, s3_access_key_id, s3_secret_access_key, fme_cloud_api_token, s3_region, iam_access_key_id, iam_secret_access_key, fme_server_instance_name, fme_server_s3_bucket, useexternaldbconnection) VALUES (new.fme_engine_id, new.name, new.server_id, new.local_path, new.server_url, new.login, new.password, new.fme_engine_type_id, new.s3_access_key_id, new.s3_secret_access_key, new.fme_cloud_api_token, new.s3_region, new.iam_access_key_id, new.iam_secret_access_key, new.fme_server_instance_name, new.fme_server_s3_bucket, new.useexternaldbconnection); -CREATE OR REPLACE RULE update_v_fme_engine AS ON UPDATE TO s_gtf.v_fme_engine DO INSTEAD UPDATE s_gtf.fme_engine SET fme_engine_id = new.fme_engine_id, name = new.name, server_id = new.server_id, local_path = new.local_path, server_url = new.server_url, login = new.login, password = new.password, fme_engine_type_id = new.fme_engine_type_id, s3_access_key_id = new.s3_access_key_id, s3_secret_access_key = new.s3_secret_access_key, fme_cloud_api_token = new.fme_cloud_api_token, s3_region = new.s3_region, iam_access_key_id = new.iam_access_key_id, iam_secret_access_key = new.iam_secret_access_key, fme_server_instance_name = new.fme_server_instance_name, fme_server_s3_bucket = new.fme_server_s3_bucket, useexternaldbconnection = new.useexternaldbconnection WHERE fme_engine.fme_engine_id = new.fme_engine_id; +UPDATE s_vitis.vm_table_field SET width = 200 WHERE label_id = 'gtf_128'; \ No newline at end of file diff --git a/src/module_gtf/web_service/sql/sqlQueries.xml b/src/module_gtf/web_service/sql/sqlQueries.xml old mode 100644 new mode 100755 index 86530ce429f2bb5289e5003497afc67a0838e81a..e877eb343ebcdc981fded8b91f784a59504279f3 --- a/src/module_gtf/web_service/sql/sqlQueries.xml +++ b/src/module_gtf/web_service/sql/sqlQueries.xml @@ -1626,13 +1626,13 @@ UPDATE s_vitis.vm_tab SET event='loadList("showSupervisionRecap()");' WHERE label_id='gtf_60' AND "name"='gtf_order'; UPDATE s_vitis.vm_table_field SET template = '<div data-app-duration-calculator="row.entity[col.field]" style="height: 100%; padding: 5px;"></div>' WHERE name = 'length_sec' AND ressource_id = 'gtf/orders'; CREATE OR REPLACE VIEW s_gtf.v_order_fast AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, "order".length_sec, gtf_engine.name FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_gtf.gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE "order".period_id IS NULL; - ALTER TABLE s_gtf.v_order_fast OWNER TO u_vitis; - GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_order_fast TO u_vitis; - GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_author; - GRANT ALL ON TABLE s_gtf.v_order_fast TO gtf_admin; - CREATE OR REPLACE VIEW s_gtf.v_supervision_status AS SELECT count(v_order_fast.order_id) AS nb_order_id, v_order_fast.order_status_id AS filter, 'order'::text AS table_name FROM s_gtf.v_order_fast GROUP BY v_order_fast.order_status_id UNION SELECT count(v_subscription.order_id) AS nb_order_id, CASE WHEN v_subscription.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'subscription'::text AS table_name FROM s_gtf.v_subscription WHERE v_subscription.lang::text = 'fr'::text GROUP BY v_subscription.enabled UNION SELECT count(v_survey.order_id) AS nb_order_id, CASE WHEN v_survey.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'survey'::text AS table_name FROM s_gtf.v_survey WHERE v_survey.lang::text = 'fr'::text GROUP BY v_survey.enabled; - CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN (SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; + ALTER TABLE s_gtf.v_order_fast OWNER TO u_vitis; + GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_user; + GRANT ALL ON TABLE s_gtf.v_order_fast TO u_vitis; + GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_author; + GRANT ALL ON TABLE s_gtf.v_order_fast TO gtf_admin; + CREATE OR REPLACE VIEW s_gtf.v_supervision_status AS SELECT count(v_order_fast.order_id) AS nb_order_id, v_order_fast.order_status_id AS filter, 'order'::text AS table_name FROM s_gtf.v_order_fast GROUP BY v_order_fast.order_status_id UNION SELECT count(v_subscription.order_id) AS nb_order_id, CASE WHEN v_subscription.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'subscription'::text AS table_name FROM s_gtf.v_subscription WHERE v_subscription.lang::text = 'fr'::text GROUP BY v_subscription.enabled UNION SELECT count(v_survey.order_id) AS nb_order_id, CASE WHEN v_survey.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'survey'::text AS table_name FROM s_gtf.v_survey WHERE v_survey.lang::text = 'fr'::text GROUP BY v_survey.enabled; + CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN (SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; -- Frédéric le 19/04/2018 16:27 UPDATE s_vitis.vm_tab SET event='loadList(''showSupervisionRecap()'',{"lang": ""});' WHERE label_id='gtf_60' AND "name"='gtf_order'; UPDATE s_vitis.vm_tab SET event='loadList("showSupervisionRecap();refreshWorkspaceListByPeriod();")' WHERE label_id='gtf_262' AND "name"='gtf_message'; @@ -1644,6 +1644,7 @@ GRANT SELECT ON TABLE s_gtf.v_supervision_status TO gtf_user; GRANT SELECT ON TABLE s_gtf.v_supervision_status TO gtf_author; UPDATE s_vitis.vm_table_field SET template = '<div data-app-message-status-icon-column="{{row.entity[col.field]}}"></div>' WHERE label_id = 'gtf_277'; + -- Frédéric le 20/04/2018 14:47 GRANT ALL ON TABLE s_gtf."message" TO gtf_scheduler; @@ -1767,233 +1768,12 @@ CREATE OR REPLACE RULE insert_v_user_order AS ON INSERT TO s_gtf.v_user_order DO INSTEAD INSERT INTO s_gtf."order" (order_id, priority_id, workspace_id, user_id, wk_params, result_url, log_url, execution_date, attempt, email_notifications, email_option_id, deleted, gtf_engine_id, order_date) VALUES (new.order_id, new.priority_id, new.workspace_id, new.user_id, new.wk_params, new.result_url, new.log_url, new.execution_date, new.attempt, new.email_notifications, new.email_option_id, false, new.gtf_engine_id, new.order_date); CREATE OR REPLACE RULE insert_v_user_subscription AS ON INSERT TO s_gtf.v_user_subscription DO INSTEAD INSERT INTO s_gtf."order" (order_id, workspace_id, user_id, period_id, execution_date, wk_params, result_url, email_option_id, email_notifications, gtf_engine_id, enabled, order_date) VALUES (new.order_id, new.workspace_id, new.user_id, new.period_id, new.execution_date, new.wk_params, new.result_url, new.email_option_id, new.email_notifications, new.gtf_engine_id, new.enabled, new.order_date); CREATE OR REPLACE RULE insert_v_user_survey AS ON INSERT TO s_gtf.v_user_survey DO INSTEAD INSERT INTO s_gtf."order" (order_id, workspace_id, user_id, enabled, period_id, execution_date, wk_params, result_url, email_option_id, email_notifications, gtf_engine_id, survey_id, condition, inbox_id, order_date) VALUES (new.order_id, new.workspace_id, new.user_id, new.enabled, new.period_id, new.execution_date, new.wk_params, new.result_url, new.email_option_id, new.email_notifications, new.gtf_engine_id, new.survey_id, CASE WHEN new.condition IS NULL THEN ''::character varying ELSE new.condition END, new.inbox_id, new.order_date); - -- Frédéric le 15/05/2018 16:15 UPDATE s_vitis.vm_tab SET event='loadList("showSupervisionRecap()");' WHERE label_id='gtf_60' AND "name"='gtf_order'; - - -- Frédéric le 15/06/2018 09:15 - ALTER TABLE s_gtf.workspace ADD COLUMN dataencrypt boolean DEFAULT FALSE; - CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template, workspace.dataencrypt FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN (SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; - - -- Frédéric le 20/06/2018 14:36 - INSERT INTO s_gtf.email_template (email_template_id, name, subject, "body", "to", cc, cci, code, use_advanced, rt_emailcontext_id, attachment) VALUES (-1, 'default_secretkey', 'Notification de clé secrète pour le traitement [order_id]', '<p>order.user.email = [order.user.email]</p> <p> </p> <p> </p> <p>Bonjour [owner_name],</p> <p>Le traitement est terminé.</p> <p>Vous pouvez télécharger le résultat sur :</p> <p>user_email] = [user_email]</p> <p>user] = [user]</p> <p>log = [log_url]</p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p>', 'tot@veremes.com', NULL, NULL, E'$logo = $this->aProperties[''ws_data_dir'']."/gtf/gtf.png";\n$base64 = base64_encode(file_get_contents($logo));\n$image = ''<img src="data:image/png;base64,''.$base64.''">'';\n$this->to = '''' . $this->aObjects["oOrder"]->getUser()->aFields[''email''] . '''';\n$this->cc = '''' . $this->aObjects["oOrder"]->aFields[''email_notifications''] . '''';\n$this->cci = '''';\n$this->subject = ''[GTF]-'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . '''';\n$this->body = $image.''<p>Bonjour,</p>'';\n$this->subject = ''[GTF]-'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . '' - Votre clé secrète'';\n$this->body .= ''<p>Votre clé secrète pour la demande n°'' . $this->aObjects["oOrder"]->aFields[''order_id''] . '' du traitement <strong>'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . ''</strong> :<br/>'' . $this->aObjects["oOrder"]->sSecretKey . ''<br/>'';\n$this->body .= ''<p><span style="color: #808080;font-size: smaller;"> Ce message a été envoyé par un automate. Merci de ne pas y répondre.</span></p>'';\n', true, 'gtf', NULL); - - -- Frédéric le 21/06/2018 10:08 - UPDATE s_gtf.email_template SET code = E'$logo = $this->aProperties[''ws_data_dir'']."/gtf/gtf.png";\n$base64 = base64_encode(file_get_contents($logo));\n$image = ''<img src="data:image/png;base64,''.$base64.''">'';\n$this->to = '''' . $this->aObjects["oOrder"]->getUser()->aFields[''email''] . '''';\n$this->cc = '''' . $this->aObjects["oOrder"]->aFields[''email_notifications''] . '''';\n$this->cci = '''';\n$this->subject = ''[GTF]-'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . '''';\n$this->body = $image.''<p>Bonjour,</p>'';\nif ($this->aObjects["oOrder"]->aFields[''order_status_id''] == 3) {\n $this->subject = ''[GTF]-'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . '' - Traitement réussi'';\n $this->body .= ''<p>Votre demande n°'' . $this->aObjects["oOrder"]->aFields[''order_id''] . '' pour le traitement <strong>'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . ''</strong> a bien été exécutée.<br/>'';\n // Si le résultat est crypté : pas de pièce jointe ou de lien de téléchargement.\n if ($aObjects[''oOrder'']->aFields[''bDataEncrypt'']) {\n $this->body .= ''Le résultat est disponible en vous connectant à l\\''application :<p><a href="'' . $aObjects[''oOrder'']->aFields[''sApplicationUrl''] . ''">'' . $aObjects[''oOrder'']->aFields[''sApplicationUrl''] . ''</a></p>'';\n }\n else if($this->aObjects["oOrder"]->aFields[''result_file''] != ''''){\n // les résultats de moins de 5 Mo sont envoyés en pièce jointe\n if (filesize($this->aObjects["oOrder"]->aFields[''result_file''])> (5*1024*1024)){\n $this->body .= ''Le résultat est disponible par téléchargement :<p><a href="'' . $this->aObjects["oOrder"]->aFields[''result_url''] . ''">Télécharger le résultat</a></p>'';\n } else {\n $this->body .= ''<p>Le résultat est disponible en pièce jointe</p>'';\n $this->aAttachments[0] = $this->aObjects["oOrder"]->aFields[''result_file''];\n }\n }\n} else {\n $this->subject = ''[GTF]-'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . '' - Echec du traitement'';\n $this->body .= ''<p>Votre demande n°'' . $this->aObjects["oOrder"]->aFields[''order_id''] . '' pour le traitement <strong>'' . $this->aObjects["oOrder"]->getWorkspace()->aFields[''name''] . ''</strong> n\\''a pu être exécutée correctement suite à une erreur.<br/> Veuillez contactez votre administrateur.<br/>'';\n $this->aAttachments[0] = $this->aObjects["oOrder"]->aFields[''log_file''];\n}\n$this->body .= ''<p><span style="color: #808080;font-size: smaller;"> Ce message a été envoyé par un automate. Merci de ne pas y répondre.</span></p>'';\n' WHERE email_template_id = 1; - - -- Frédéric le 21/06/2018 12:15 - ALTER TABLE s_gtf.workspace ADD COLUMN usepersonaldata boolean DEFAULT FALSE; - - -- Frédéric le 21/06/2018 14:00 - CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template, workspace.dataencrypt, workspace.usepersonaldata FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN (SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; - - -- Frédéric le 25/06/2018 10:54 - ALTER TABLE s_gtf.workspace ADD COLUMN unitcost float; - ALTER TABLE s_gtf.workspace ADD COLUMN costpersecond float; - CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template, workspace.dataencrypt, workspace.usepersonaldata, workspace.unitcost, workspace.costpersecond FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN (SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; - - -- Anthony le 10/07/2018 17:00 + -- Anthony ajout sur le tag pour DtNet INSERT INTO s_gtf.actionclass (actionclass, label) VALUES ('SMSAction', '<p>Notification d''envoi de SMS</p>'); - - -- Frédéric le 18/07/2018 14:45 - ALTER TABLE s_gtf.order ADD COLUMN minexecdate timestamp with time zone; - - INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('Champ minexecdate de l''onglet gtf_user_order', 'gtf_327'); - INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('Champ minexecdate de l''onglet gtf_order', 'gtf_328'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_327', 'fr', 'Date de planification'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_327', 'en', 'Planning date'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_328', 'fr', 'Date de planification'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_328', 'en', 'Planning date'); - INSERT INTO s_vitis.vm_table_field (table_field_id, name, sortable, resizeable, index, width, align, label_id, module, ressource_id, template, tab_id) VALUES ((select nextval('s_vitis.seq_vm'::regclass)), 'minexecdate', true, true, 9, 120, 'left', 'gtf_327', NULL, 'gtf/userorders', '<div data-app-format-date-column="{{row.entity[col.field]}}"></div>', (select tab_id from s_vitis.vm_tab where name = 'gtf_user_order')); - INSERT INTO s_vitis.vm_table_field (table_field_id, name, sortable, resizeable, index, width, align, label_id, module, ressource_id, template, tab_id) VALUES ((select nextval('s_vitis.seq_vm'::regclass)), 'minexecdate', true, true, 9, 120, 'left', 'gtf_328', NULL, 'gtf/orders', '<div data-app-format-date-column="{{row.entity[col.field]}}"></div>', (select tab_id from s_vitis.vm_tab where name = 'gtf_order')); - - ALTER TABLE s_gtf.message ADD COLUMN minexecdate timestamp with time zone; - INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('Champ minexecdate de l''onglet gtf_message', 'gtf_329'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_329', 'fr', 'Date de planification'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_329', 'en', 'Planning date'); - INSERT INTO s_vitis.vm_table_field (table_field_id, name, sortable, resizeable, index, width, align, label_id, module, ressource_id, template, tab_id) VALUES ((select nextval('s_vitis.seq_vm'::regclass)), 'minexecdate', true, true, 6, 120, 'left', 'gtf_329', NULL, 'gtf/messages', '<div data-app-format-date-column="{{row.entity[col.field]}}"></div>', (select tab_id from s_vitis.vm_tab where name = 'gtf_message')); - - -- Frédéric le 19/07/2018 10:53 - CREATE OR REPLACE VIEW s_gtf.v_message AS SELECT message.message_id, message.messageclass, message.creation_date, message.body, message.sender, messageclass.messageclass_type, message.status, message.minexecdate FROM s_gtf.message LEFT JOIN s_gtf.messageclass ON message.messageclass::text = messageclass.messageclass::text; - - -- Frédéric le 20/07/2018 12:23 - CREATE OR REPLACE VIEW s_gtf.v_order AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, s_gtf.s2hms("order".length_sec) AS length_sec, priority_translation.translation AS priority_label, email_option_translation.translation AS email_option_label, priority_translation.lang, gtf_engine.name, order_status_translation.translation AS order_status_label, timezone("user".timezone_id::text, "order".minexecdate) AS minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_vitis.vm_translation priority_translation ON rt_priority.label_id::text = priority_translation.translation_id::text LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_vitis.vm_translation order_status_translation ON rt_order_status.label_id::text = order_status_translation.translation_id::text AND priority_translation.lang::text = order_status_translation.lang::text LEFT JOIN s_gtf.gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE "order".period_id IS NULL AND priority_translation.lang::text = email_option_translation.lang::text; - CREATE OR REPLACE VIEW s_gtf.v_order_fast AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, "order".length_sec, gtf_engine.name, timezone("user".timezone_id::text, "order".minexecdate) AS minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_gtf.gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE "order".period_id IS NULL; - CREATE OR REPLACE VIEW s_gtf.v_user_order AS SELECT "order".order_id, "order".priority_id, workspace.key AS workspace_key, "order".workspace_id, workspace.name, "order".order_status_id, "order".user_id, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, s_gtf.s2hms("order".length_sec) AS length_sec, workspace.name AS workspace_name, priority_translation.translation AS priority_label, email_option_translation.translation AS email_option_label, priority_translation.lang, order_status_translation.lang AS order_status_lang, order_status_translation.translation AS order_status_label, timezone("user".timezone_id::text, "order".minexecdate) AS minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_vitis.vm_translation priority_translation ON rt_priority.label_id::text = priority_translation.translation_id::text LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_vitis.vm_translation order_status_translation ON rt_order_status.label_id::text = order_status_translation.translation_id::text LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id WHERE "order".user_id::text ~ similar_escape((( SELECT "user".user_id FROM s_vitis."user" WHERE "user".login::name = "current_user"()))::text, NULL::text) AND "order".period_id IS NULL AND "order".deleted IS NOT TRUE AND priority_translation.lang::text = email_option_translation.lang::text AND priority_translation.lang::text = order_status_translation.lang::text; - CREATE OR REPLACE RULE insert_v_user_order AS ON INSERT TO s_gtf.v_user_order DO INSTEAD INSERT INTO s_gtf."order" (order_id, priority_id, workspace_id, user_id, wk_params, result_url, log_url, execution_date, attempt, email_notifications, email_option_id, deleted, gtf_engine_id, order_date, minexecdate) VALUES (new.order_id, new.priority_id, new.workspace_id, new.user_id, new.wk_params, new.result_url, new.log_url, new.execution_date, new.attempt, new.email_notifications, new.email_option_id, false, new.gtf_engine_id, new.order_date, new.minexecdate); - - -- Frédéric le 20/07/2018 15:30 - ALTER TABLE s_gtf.job ALTER COLUMN execution_date TYPE timestamp with time zone; - DROP VIEW s_gtf.v_supervision_status; - DROP VIEW s_gtf.v_subscription; - DROP VIEW s_gtf.v_survey; - DROP VIEW s_gtf.v_user_subscription; - DROP VIEW s_gtf.v_user_survey; - DROP VIEW s_gtf.v_order; - DROP VIEW s_gtf.v_author_workspace; - DROP VIEW s_gtf.v_workspace; - DROP VIEW s_gtf.v_user_order; - DROP VIEW s_gtf.v_order_fast; - - ALTER TABLE s_gtf.order ALTER COLUMN order_date TYPE timestamp with time zone; - ALTER TABLE s_gtf.order ALTER COLUMN execution_date TYPE timestamp with time zone; - ALTER TABLE s_gtf.workspace ALTER COLUMN last_save_date TYPE timestamp with time zone; - ALTER TABLE s_gtf.workspace ALTER COLUMN creation_date TYPE timestamp with time zone; - - CREATE OR REPLACE VIEW s_gtf.v_user_order AS SELECT "order".order_id, "order".priority_id, workspace.key AS workspace_key, "order".workspace_id, workspace.name, "order".order_status_id, "order".user_id, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, s_gtf.s2hms("order".length_sec) AS length_sec, workspace.name AS workspace_name, priority_translation.translation AS priority_label, email_option_translation.translation AS email_option_label, priority_translation.lang, order_status_translation.lang AS order_status_lang, order_status_translation.translation AS order_status_label, "order".minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_vitis.vm_translation priority_translation ON rt_priority.label_id::text = priority_translation.translation_id::text LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_vitis.vm_translation order_status_translation ON rt_order_status.label_id::text = order_status_translation.translation_id::text LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id WHERE "order".user_id::text ~ similar_escape((( SELECT user_1.user_id FROM s_vitis."user" user_1 WHERE user_1.login::name = "current_user"()))::text, NULL::text) AND "order".period_id IS NULL AND "order".deleted IS NOT TRUE AND priority_translation.lang::text = email_option_translation.lang::text AND priority_translation.lang::text = order_status_translation.lang::text; - ALTER TABLE s_gtf.v_user_order OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_user_order TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_user_order TO gtf_user; - GRANT SELECT ON TABLE s_gtf.v_user_order TO gtf_author; - CREATE OR REPLACE RULE delete_v_user_order AS ON DELETE TO s_gtf.v_user_order DO INSTEAD UPDATE s_gtf."order" SET deleted = true WHERE "order".order_id = old.order_id; - CREATE OR REPLACE RULE insert_v_user_order AS ON INSERT TO s_gtf.v_user_order DO INSTEAD INSERT INTO s_gtf."order" (order_id, priority_id, workspace_id, user_id, wk_params, result_url, log_url, execution_date, attempt, email_notifications, email_option_id, deleted, gtf_engine_id, order_date, minexecdate) VALUES (new.order_id, new.priority_id, new.workspace_id, new.user_id, new.wk_params, new.result_url, new.log_url, new.execution_date, new.attempt, new.email_notifications, new.email_option_id, false, new.gtf_engine_id, new.order_date, new.minexecdate); - - CREATE OR REPLACE VIEW s_gtf.v_order_fast AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, "order".length_sec, gtf_engine.name, "order".minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_gtf.gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE "order".period_id IS NULL; - ALTER TABLE s_gtf.v_order_fast OWNER TO u_vitis; - GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_user; - GRANT SELECT ON TABLE s_gtf.v_order_fast TO gtf_author; - GRANT ALL ON TABLE s_gtf.v_order_fast TO gtf_admin; - - CREATE OR REPLACE VIEW s_gtf.v_workspace AS SELECT workspace.workspace_id, workspace.name, workspace.owner, workspace.creation_date, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.success_action_id, workspace.failed_action_id, workspace.survey, workspace.form_type, workspace.legal_terms_conditions, workspace.last_save_date, workspace.last_save_build, workspace.file_encoding, workspace.title, workspace.requirements, workspace.history, workspace.usage, workspace.key, workspace.email_template_id, workspace.locked, workspace.tag, "user".login, category.name AS category_name, CASE WHEN t.nb_demandes IS NULL THEN 0::bigint ELSE t.nb_demandes END AS nb_demande, email_template.name AS email_template, workspace.dataencrypt, workspace.usepersonaldata, workspace.unitcost, workspace.costpersecond FROM s_gtf.workspace LEFT JOIN s_vitis."user" ON workspace.owner = "user".user_id LEFT JOIN s_gtf.category ON workspace.category_id = category.category_id LEFT JOIN s_gtf.email_template ON workspace.email_template_id = email_template.email_template_id LEFT JOIN ( SELECT count(*) AS nb_demandes, v_order_fast.workspace_id FROM s_gtf.v_order_fast GROUP BY v_order_fast.workspace_id) t ON workspace.workspace_id = t.workspace_id; - ALTER TABLE s_gtf.v_workspace OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_workspace TO gtf_admin; - GRANT SELECT ON TABLE s_gtf.v_workspace TO gtf_user; - GRANT SELECT ON TABLE s_gtf.v_workspace TO gtf_author; - - CREATE OR REPLACE VIEW s_gtf.v_author_workspace AS SELECT v_workspace.workspace_id, v_workspace.name, v_workspace.owner, v_workspace.creation_date, v_workspace.description, v_workspace.subscription, v_workspace.fmw_file, v_workspace.category_id, v_workspace.success_action_id, v_workspace.failed_action_id, v_workspace.survey, v_workspace.form_type, v_workspace.legal_terms_conditions, v_workspace.last_save_date, v_workspace.last_save_build, v_workspace.file_encoding, v_workspace.title, v_workspace.requirements, v_workspace.history, v_workspace.usage, v_workspace.key, v_workspace.email_template_id, v_workspace.locked, v_workspace.tag, v_workspace.login, v_workspace.category_name, v_workspace.nb_demande, v_workspace.email_template, v_workspace.dataencrypt FROM s_gtf.v_workspace WHERE v_workspace.login::name::text = "current_user"()::text; - ALTER TABLE s_gtf.v_author_workspace OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_author_workspace TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_author_workspace TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_author_workspace TO gtf_author; - - CREATE OR REPLACE VIEW s_gtf.v_order AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, s_gtf.s2hms("order".length_sec) AS length_sec, priority_translation.translation AS priority_label, email_option_translation.translation AS email_option_label, priority_translation.lang, gtf_engine.name, order_status_translation.translation AS order_status_label, "order".minexecdate FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_priority ON "order".priority_id = rt_priority.priority_id LEFT JOIN s_vitis.vm_translation priority_translation ON rt_priority.label_id::text = priority_translation.translation_id::text LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_gtf.rt_order_status ON "order".order_status_id = rt_order_status.order_status_id LEFT JOIN s_vitis.vm_translation order_status_translation ON rt_order_status.label_id::text = order_status_translation.translation_id::text AND priority_translation.lang::text = order_status_translation.lang::text LEFT JOIN s_gtf.gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE "order".period_id IS NULL AND priority_translation.lang::text = email_option_translation.lang::text; - ALTER TABLE s_gtf.v_order OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_order TO gtf_admin; - GRANT SELECT ON TABLE s_gtf.v_order TO gtf_user; - GRANT SELECT ON TABLE s_gtf.v_order TO gtf_author; - CREATE OR REPLACE RULE delete_v_order AS ON DELETE TO s_gtf.v_order DO INSTEAD DELETE FROM s_gtf."order" WHERE "order".order_id = old.order_id; - - CREATE OR REPLACE VIEW s_gtf.v_subscription AS SELECT "order".order_id, "order".priority_id, "order".workspace_id, workspace.key AS workspace_key, "order".enabled, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, email_option_translation.translation AS notification, email_option_translation.lang FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text WHERE "order".period_id IS NOT NULL AND "order".survey_id IS NULL; - ALTER TABLE s_gtf.v_subscription OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_subscription TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_subscription TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_subscription TO gtf_author; - CREATE OR REPLACE RULE delete_v_subscription AS ON DELETE TO s_gtf.v_subscription DO INSTEAD DELETE FROM s_gtf."order" WHERE "order".order_id = old.order_id; - - CREATE OR REPLACE VIEW s_gtf.v_survey AS SELECT "order".order_id, workspace.key AS workspace_key, "order".priority_id, "order".workspace_id, "order".enabled, workspace.name AS label_name, "order".order_status_id, "order".user_id, "user".login, "order".period_id, period.name AS order_period_libelle, "order".wk_params, "order".result_url, "order".order_date, "order".log_url, "order".execution_date, "order".attempt, "order".email_notifications, "order".email_option_id, "order".deleted, "order".gtf_engine_id, "order".survey_id, "order".condition, inbox.alias AS warehouse_name, email_option_translation.translation AS notification, email_option_translation.lang, survey_type_translation.translation AS survey_name FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_vitis."user" ON "user".user_id = "order".user_id LEFT JOIN s_gtf.inbox ON "order".inbox_id = inbox.inbox_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_gtf.rt_survey_type ON "order".survey_id = rt_survey_type.survey_id LEFT JOIN s_vitis.vm_translation survey_type_translation ON rt_survey_type.label_id::text = survey_type_translation.translation_id::text WHERE "order".period_id IS NOT NULL AND "order".survey_id = 1 AND email_option_translation.lang::text = survey_type_translation.lang::text; - ALTER TABLE s_gtf.v_survey OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_survey TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_survey TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_survey TO gtf_author; - CREATE OR REPLACE RULE delete_v_survey AS ON DELETE TO s_gtf.v_survey DO INSTEAD DELETE FROM s_gtf."order" WHERE "order".order_id = old.order_id; - - CREATE OR REPLACE VIEW s_gtf.v_supervision_status AS SELECT count(v_order.order_id) AS nb_order_id, v_order.order_status_id AS filter, 'order'::text AS table_name FROM s_gtf.v_order WHERE v_order.lang::text = 'fr'::text GROUP BY v_order.order_status_id UNION SELECT count(v_subscription.order_id) AS nb_order_id, CASE WHEN v_subscription.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'subscription'::text AS table_name FROM s_gtf.v_subscription WHERE v_subscription.lang::text = 'fr'::text GROUP BY v_subscription.enabled UNION SELECT count(v_survey.order_id) AS nb_order_id, CASE WHEN v_survey.enabled IS TRUE THEN 1 ELSE 0 END AS filter, 'survey'::text AS table_name FROM s_gtf.v_survey WHERE v_survey.lang::text = 'fr'::text GROUP BY v_survey.enabled UNION SELECT count(message.message_id) AS nb_order_id, message.status AS filter, 'message'::text AS table_name FROM s_gtf.message GROUP BY message.status; - ALTER TABLE s_gtf.v_supervision_status OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_supervision_status TO gtf_admin; - GRANT SELECT ON TABLE s_gtf.v_supervision_status TO gtf_user; - GRANT SELECT ON TABLE s_gtf.v_supervision_status TO gtf_author; - - CREATE OR REPLACE VIEW s_gtf.v_user_survey AS SELECT "order".order_id, workspace.key AS workspace_key, "order".workspace_id, workspace.name AS label_name, "order".enabled, "order".order_status_id, "order".user_id, "order".period_id, "order".order_date, "order".execution_date, "order".wk_params, "order".result_url, "order".email_option_id, "order".email_notifications, "order".gtf_engine_id, "order".survey_id, "order".condition, "order".inbox_id, inbox.alias AS name, workspace.name AS workspace_name, "order".survey_id AS monitoring_type, email_option_translation.translation AS notification, email_option_translation.lang, period.name AS order_period_libelle, survey_type_translation.translation AS survey_name FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_gtf.period ON "order".period_id = period.period_id LEFT JOIN s_gtf.inbox ON "order".inbox_id = inbox.inbox_id LEFT JOIN s_gtf.rt_survey_type ON "order".survey_id = rt_survey_type.survey_id LEFT JOIN s_vitis.vm_translation survey_type_translation ON rt_survey_type.label_id::text = survey_type_translation.translation_id::text WHERE "order".user_id::text ~ similar_escape((( SELECT "user".user_id FROM s_vitis."user" WHERE "user".login::name = "current_user"()))::text, NULL::text) AND "order".period_id IS NOT NULL AND "order".survey_id = 1 AND email_option_translation.lang::text = survey_type_translation.lang::text; - ALTER TABLE s_gtf.v_user_survey OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_user_survey TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_user_survey TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_user_survey TO gtf_author; - COMMENT ON COLUMN s_gtf.v_user_survey.label_name IS 'Deprecated'; - COMMENT ON COLUMN s_gtf.v_user_survey.survey_id IS 'Deprecated'; - - CREATE OR REPLACE RULE delete_v_user_survey AS ON DELETE TO s_gtf.v_user_survey DO INSTEAD DELETE FROM s_gtf."order" WHERE "order".order_id = old.order_id; - CREATE OR REPLACE RULE insert_v_user_survey AS ON INSERT TO s_gtf.v_user_survey DO INSTEAD INSERT INTO s_gtf."order" (order_id, workspace_id, user_id, enabled, period_id, execution_date, wk_params, result_url, email_option_id, email_notifications, gtf_engine_id, survey_id, condition, inbox_id, order_date) VALUES (new.order_id, new.workspace_id, new.user_id, new.enabled, new.period_id, new.execution_date, new.wk_params, new.result_url, new.email_option_id, new.email_notifications, new.gtf_engine_id, new.survey_id, CASE WHEN new.condition IS NULL THEN ''::character varying ELSE new.condition END, new.inbox_id, new.order_date); - CREATE OR REPLACE RULE update_v_user_survey AS ON UPDATE TO s_gtf.v_user_survey DO INSTEAD UPDATE s_gtf."order" SET order_id = new.order_id, workspace_id = new.workspace_id, enabled = new.enabled, order_status_id = new.order_status_id, user_id = new.user_id, period_id = new.period_id, order_date = new.order_date, execution_date = new.execution_date, wk_params = new.wk_params, result_url = new.result_url, email_option_id = new.email_option_id, email_notifications = new.email_notifications, gtf_engine_id = new.gtf_engine_id, survey_id = new.survey_id, condition = CASE WHEN new.condition IS NULL THEN ''::character varying ELSE new.condition END, inbox_id = new.inbox_id WHERE "order".order_id = new.order_id; - CREATE OR REPLACE VIEW s_gtf.v_user_subscription AS SELECT "order".order_id, "order".workspace_id, workspace.key AS workspace_key, "order".enabled, workspace.name AS label_name, "order".order_status_id, "order".user_id, "order".period_id, "order".order_date, "order".execution_date, "order".wk_params, "order".result_url, "order".email_option_id, "order".email_notifications, "order".gtf_engine_id, workspace.name AS workspace_name, email_option_translation.translation AS notification, period.name AS order_period_libelle, email_option_translation.lang FROM s_gtf."order" LEFT JOIN s_gtf.workspace ON "order".workspace_id = workspace.workspace_id LEFT JOIN s_gtf.rt_email_option ON "order".email_option_id = rt_email_option.email_option_id LEFT JOIN s_vitis.vm_translation email_option_translation ON rt_email_option.label_id::text = email_option_translation.translation_id::text LEFT JOIN s_gtf.period ON "order".period_id = period.period_id WHERE "order".user_id::text ~ similar_escape((( SELECT "user".user_id FROM s_vitis."user" WHERE "user".login::name = "current_user"()))::text, NULL::text) AND "order".period_id IS NOT NULL AND "order".survey_id IS NULL; - - ALTER TABLE s_gtf.v_user_subscription OWNER TO u_vitis; - GRANT ALL ON TABLE s_gtf.v_user_subscription TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_user_subscription TO gtf_admin; - GRANT ALL ON TABLE s_gtf.v_user_subscription TO gtf_author; - COMMENT ON COLUMN s_gtf.v_user_subscription.label_name IS 'Deprecated'; - - CREATE OR REPLACE RULE delete_v_user_subscription AS ON DELETE TO s_gtf.v_user_subscription DO INSTEAD DELETE FROM s_gtf."order" WHERE "order".order_id = old.order_id; - CREATE OR REPLACE RULE insert_v_user_subscription AS ON INSERT TO s_gtf.v_user_subscription DO INSTEAD INSERT INTO s_gtf."order" (order_id, workspace_id, user_id, period_id, execution_date, wk_params, result_url, email_option_id, email_notifications, gtf_engine_id, enabled, order_date) VALUES (new.order_id, new.workspace_id, new.user_id, new.period_id, new.execution_date, new.wk_params, new.result_url, new.email_option_id, new.email_notifications, new.gtf_engine_id, new.enabled, new.order_date); - CREATE OR REPLACE RULE update_v_user_subscription AS ON UPDATE TO s_gtf.v_user_subscription DO INSTEAD UPDATE s_gtf."order" SET workspace_id = new.workspace_id, enabled = new.enabled, order_status_id = new.order_status_id, period_id = new.period_id, execution_date = new.execution_date, wk_params = new.wk_params, email_option_id = new.email_option_id, email_notifications = new.email_notifications WHERE "order".order_id = new.order_id; - - -- Frédéric le 23/07/2018 16:54 - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_order') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_survey') AND name = 'execution_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_subscription') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_subscription') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_survey') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_message') AND name = 'creation_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_order') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_survey') AND name = 'order_date'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_order') AND name = 'minexecdate'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_order') AND name = 'minexecdate'; - UPDATE s_vitis.vm_table_field SET template = NULL WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_message') AND name = 'minexecdate'; - - -- Frédéric le 26/07/2018 14:23 - DELETE FROM s_vitis.vm_table_field WHERE tab_id = (select tab_id from s_vitis.vm_tab where name = 'gtf_user_order') AND name = 'priority_label'; - - -- Anthony le 08/08/2018 - -- Ajout de workspace.key dans la vue v_user_workspace - CREATE OR REPLACE VIEW s_gtf.v_user_workspace AS SELECT DISTINCT workspace.workspace_id, workspace.name, workspace.description, workspace.subscription, workspace.fmw_file, workspace.category_id, workspace.survey, workspace_group.group_id, workspace.key FROM s_gtf.workspace, s_gtf.workspace_group WHERE workspace.workspace_id = workspace_group.workspace_id ORDER BY workspace.workspace_id, workspace.name, workspace.description, workspace.subscription, workspace.fmw_file; - -- Correction suite à discussion avec Yoann un gtf_user ne doit pas pouvoir lister tous les projets - REVOKE ALL ON s_gtf.v_workspace FROM gtf_user; ]]> </code> </query> - <query> - <type>update</type> - <version>2018.02.01</version> - <code> - <![CDATA[ - -- Frédéric le 10/09/2018 12:00 - ALTER TABLE s_gtf.fme_engine ADD COLUMN fme_server_instance_name character varying(50); - CREATE OR REPLACE VIEW s_gtf.v_fme_engine AS SELECT fme_engine.fme_engine_id, fme_engine.name, fme_engine.server_id, fme_engine.local_path, server.hostname AS server_name, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_engine_type_id, fme_engine.s3_access_key_id, fme_engine.s3_secret_access_key, fme_engine.fme_cloud_api_token, v_fme_engine_type.fme_engine_type_label, v_fme_engine_type.lang, fme_engine.s3_region, fme_engine.iam_access_key_id, fme_engine.iam_secret_access_key, fme_engine.fme_server_instance_name FROM s_gtf.fme_engine LEFT JOIN s_gtf.server ON fme_engine.server_id = server.server_id LEFT JOIN s_gtf.v_fme_engine_type ON fme_engine.fme_engine_type_id::text = v_fme_engine_type.fme_engine_type_id::text; - CREATE OR REPLACE RULE insert_v_fme_engine AS ON INSERT TO s_gtf.v_fme_engine DO INSTEAD INSERT INTO s_gtf.fme_engine (fme_engine_id, name, server_id, local_path, server_url, login, password, fme_engine_type_id, s3_access_key_id, s3_secret_access_key, fme_cloud_api_token, s3_region, iam_access_key_id, iam_secret_access_key, fme_server_instance_name) VALUES (new.fme_engine_id, new.name, new.server_id, new.local_path, new.server_url, new.login, new.password, new.fme_engine_type_id, new.s3_access_key_id, new.s3_secret_access_key, new.fme_cloud_api_token, new.s3_region, new.iam_access_key_id, new.iam_secret_access_key, new.fme_server_instance_name); - CREATE OR REPLACE RULE update_v_fme_engine AS ON UPDATE TO s_gtf.v_fme_engine DO INSTEAD UPDATE s_gtf.fme_engine SET fme_engine_id = new.fme_engine_id, name = new.name, server_id = new.server_id, local_path = new.local_path, server_url = new.server_url, login = new.login, password = new.password, fme_engine_type_id = new.fme_engine_type_id, s3_access_key_id = new.s3_access_key_id, s3_secret_access_key = new.s3_secret_access_key, fme_cloud_api_token = new.fme_cloud_api_token, s3_region = new.s3_region, iam_access_key_id = new.iam_access_key_id, iam_secret_access_key = new.iam_secret_access_key, fme_server_instance_name = new.fme_server_instance_name WHERE fme_engine.fme_engine_id = new.fme_engine_id; - - -- Frédéric le 12/09/2018 15:15 - ALTER TABLE s_gtf.workspace ADD COLUMN version integer DEFAULT 0; - CREATE FUNCTION s_gtf.update_workspace_version() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN SELECT INTO new.version version + 1 FROM s_gtf.workspace WHERE workspace.workspace_id = new.workspace_id; return New; END; $$; - ALTER FUNCTION s_gtf.update_workspace_version() OWNER TO u_vitis; - CREATE TRIGGER before_update_workspace BEFORE UPDATE ON s_gtf.workspace FOR EACH ROW EXECUTE PROCEDURE s_gtf.update_workspace_version(); - - -- Frédéric le 13/09/2018 11:30 - ALTER TABLE s_gtf.fme_engine ADD COLUMN fme_server_s3_bucket character varying(50); - CREATE OR REPLACE VIEW s_gtf.v_fme_engine AS SELECT fme_engine.fme_engine_id, fme_engine.name, fme_engine.server_id, fme_engine.local_path, server.hostname AS server_name, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_engine_type_id, fme_engine.s3_access_key_id, fme_engine.s3_secret_access_key, fme_engine.fme_cloud_api_token, v_fme_engine_type.fme_engine_type_label, v_fme_engine_type.lang, fme_engine.s3_region, fme_engine.iam_access_key_id, fme_engine.iam_secret_access_key, fme_engine.fme_server_instance_name, fme_engine.fme_server_s3_bucket FROM s_gtf.fme_engine LEFT JOIN s_gtf.server ON fme_engine.server_id = server.server_id LEFT JOIN s_gtf.v_fme_engine_type ON fme_engine.fme_engine_type_id::text = v_fme_engine_type.fme_engine_type_id::text; - CREATE OR REPLACE RULE insert_v_fme_engine AS ON INSERT TO s_gtf.v_fme_engine DO INSTEAD INSERT INTO s_gtf.fme_engine (fme_engine_id, name, server_id, local_path, server_url, login, password, fme_engine_type_id, s3_access_key_id, s3_secret_access_key, fme_cloud_api_token, s3_region, iam_access_key_id, iam_secret_access_key, fme_server_instance_name, fme_server_s3_bucket) VALUES (new.fme_engine_id, new.name, new.server_id, new.local_path, new.server_url, new.login, new.password, new.fme_engine_type_id, new.s3_access_key_id, new.s3_secret_access_key, new.fme_cloud_api_token, new.s3_region, new.iam_access_key_id, new.iam_secret_access_key, new.fme_server_instance_name, new.fme_server_s3_bucket); - CREATE OR REPLACE RULE update_v_fme_engine AS ON UPDATE TO s_gtf.v_fme_engine DO INSTEAD UPDATE s_gtf.fme_engine SET fme_engine_id = new.fme_engine_id, name = new.name, server_id = new.server_id, local_path = new.local_path, server_url = new.server_url, login = new.login, password = new.password, fme_engine_type_id = new.fme_engine_type_id, s3_access_key_id = new.s3_access_key_id, s3_secret_access_key = new.s3_secret_access_key, fme_cloud_api_token = new.fme_cloud_api_token, s3_region = new.s3_region, iam_access_key_id = new.iam_access_key_id, iam_secret_access_key = new.iam_secret_access_key, fme_server_instance_name = new.fme_server_instance_name, fme_server_s3_bucket = new.fme_server_s3_bucket WHERE fme_engine.fme_engine_id = new.fme_engine_id; - - -- Anthony le 18/09/2018 14:43 - ALTER TABLE s_gtf.fme_engine ADD COLUMN useexternaldbconnection boolean DEFAULT FALSE; - DROP VIEW s_gtf.v_fme_engine; - CREATE OR REPLACE VIEW s_gtf.v_fme_engine AS SELECT fme_engine.fme_engine_id, fme_engine.name, fme_engine.server_id, fme_engine.local_path, server.hostname AS server_name, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_engine_type_id, fme_engine.s3_access_key_id, fme_engine.s3_secret_access_key, fme_engine.fme_cloud_api_token, v_fme_engine_type.fme_engine_type_label, v_fme_engine_type.lang, fme_engine.s3_region, fme_engine.iam_access_key_id, fme_engine.iam_secret_access_key, fme_engine.fme_server_instance_name, fme_engine.fme_server_s3_bucket, useexternaldbconnection FROM s_gtf.fme_engine LEFT JOIN s_gtf.server ON fme_engine.server_id = server.server_id LEFT JOIN s_gtf.v_fme_engine_type ON fme_engine.fme_engine_type_id::text = v_fme_engine_type.fme_engine_type_id::text; - ALTER TABLE s_gtf.v_fme_engine OWNER TO u_vitis; - GRANT SELECT ON TABLE s_gtf.v_fme_engine TO gtf_user; - GRANT ALL ON TABLE s_gtf.v_fme_engine TO u_vitis; - GRANT SELECT ON TABLE s_gtf.v_fme_engine TO gtf_author; - GRANT ALL ON TABLE s_gtf.v_fme_engine TO gtf_admin; - CREATE OR REPLACE RULE insert_v_fme_engine AS ON INSERT TO s_gtf.v_fme_engine DO INSTEAD INSERT INTO s_gtf.fme_engine (fme_engine_id, name, server_id, local_path, server_url, login, password, fme_engine_type_id, s3_access_key_id, s3_secret_access_key, fme_cloud_api_token, s3_region, iam_access_key_id, iam_secret_access_key, fme_server_instance_name, fme_server_s3_bucket, useexternaldbconnection) VALUES (new.fme_engine_id, new.name, new.server_id, new.local_path, new.server_url, new.login, new.password, new.fme_engine_type_id, new.s3_access_key_id, new.s3_secret_access_key, new.fme_cloud_api_token, new.s3_region, new.iam_access_key_id, new.iam_secret_access_key, new.fme_server_instance_name, new.fme_server_s3_bucket, new.useexternaldbconnection); - CREATE OR REPLACE RULE update_v_fme_engine AS ON UPDATE TO s_gtf.v_fme_engine DO INSTEAD UPDATE s_gtf.fme_engine SET fme_engine_id = new.fme_engine_id, name = new.name, server_id = new.server_id, local_path = new.local_path, server_url = new.server_url, login = new.login, password = new.password, fme_engine_type_id = new.fme_engine_type_id, s3_access_key_id = new.s3_access_key_id, s3_secret_access_key = new.s3_secret_access_key, fme_cloud_api_token = new.fme_cloud_api_token, s3_region = new.s3_region, iam_access_key_id = new.iam_access_key_id, iam_secret_access_key = new.iam_secret_access_key, fme_server_instance_name = new.fme_server_instance_name, fme_server_s3_bucket = new.fme_server_s3_bucket, useexternaldbconnection = new.useexternaldbconnection WHERE fme_engine.fme_engine_id = new.fme_engine_id; - CREATE OR REPLACE RULE delete_v_fme_engine AS ON DELETE TO s_gtf.v_fme_engine DO INSTEAD DELETE FROM s_gtf.fme_engine WHERE fme_engine.fme_engine_id = old.fme_engine_id; - - -- Frédéric le 01/10/2018 16:30 - ALTER TABLE s_gtf."order" ADD COLUMN pid integer DEFAULT NULL; - - -- Frédéric le 04/10/2018 11:30 - UPDATE s_vitis.vm_table_button SET event = 'deleteGtfOrders' WHERE tab_id=(select tab_id from s_vitis.vm_tab where name = 'gtf_order') AND label_id='gtf_136'; - - - -- Frédéric le 11/10/2018 15:00 - INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('Bouton d''arrêt d''une demande en cours table_button_id = 43', 'gtf_330'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_330', 'fr', 'Stopper le processus'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_330', 'en', 'Stop the process'); - INSERT INTO s_vitis.vm_table_button (button_class, table_button_id, event, label_id, ressource_id, tab_id) VALUES ('stopOrderProcessFlexigrid', (select nextval('s_vitis.seq_vm'::regclass)), 'stopOrderProcess', 'gtf_330', 'gtf/orders', (select tab_id from s_vitis.vm_tab where name = 'gtf_order')); - INSERT INTO s_vitis.vm_string (string, string_id) VALUES ('"Order_status_id 7 de la table tr_order_staus (Stoppé)', 'gtf_331'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_331', 'fr', 'Stoppé'); - INSERT INTO s_vitis.vm_translation (translation_id, lang, translation) VALUES ('gtf_331', 'en', 'Stopped'); - INSERT INTO s_gtf.rt_order_status (order_status_id, label_id) VALUES (7, 'gtf_331'); - ]]> - </code> - </query> </queriesCollection> </sqlQueries> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/Categories.class.inc b/src/module_gtf/web_service/ws/Categories.class.inc index a4d1402860b6b3f0115307fc6157fa07d8b9bd86..36bb182cabb15883a3ddc5a2ec40b71a8baedacc 100755 --- a/src/module_gtf/web_service/ws/Categories.class.inc +++ b/src/module_gtf/web_service/ws/Categories.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Category.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Categories extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Category.class.inc b/src/module_gtf/web_service/ws/Category.class.inc index 3dbcbeb66c96c167d9ced1aba485188750776d32..efe469a5873544f8a0046a04bfc7712813dab566 100755 --- a/src/module_gtf/web_service/ws/Category.class.inc +++ b/src/module_gtf/web_service/ws/Category.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Category.class.inc diff --git a/src/module_gtf/web_service/ws/EmailContext.class.inc b/src/module_gtf/web_service/ws/EmailContext.class.inc index b9b8bbeb6b138f1f2aabb36e910ab916de528c24..a26ed36db6d7915cce6c05c170864fcb122bc2bb 100755 --- a/src/module_gtf/web_service/ws/EmailContext.class.inc +++ b/src/module_gtf/web_service/ws/EmailContext.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file EmailContext.class.inc diff --git a/src/module_gtf/web_service/ws/EmailContexts.class.inc b/src/module_gtf/web_service/ws/EmailContexts.class.inc index b69471fa62f682116951994109fc045eb0f0780a..6d0efd2a4fa92f4c1ea54d4e9c83f0f7b87e2efa 100755 --- a/src/module_gtf/web_service/ws/EmailContexts.class.inc +++ b/src/module_gtf/web_service/ws/EmailContexts.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'EmailContext.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class EmailContexts extends GTF { /** diff --git a/src/module_gtf/web_service/ws/EmailOption.class.inc b/src/module_gtf/web_service/ws/EmailOption.class.inc index c5d0e8d2d696fd666bbf1c3441df65d52870ceba..a1d1d66429cbafcca63127572aa8761352cdeafa 100755 --- a/src/module_gtf/web_service/ws/EmailOption.class.inc +++ b/src/module_gtf/web_service/ws/EmailOption.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file EmailOption.class.inc diff --git a/src/module_gtf/web_service/ws/EmailOptions.class.inc b/src/module_gtf/web_service/ws/EmailOptions.class.inc index a786997fba0b184bb54022fbdcce314e8d33058b..a102a59cccaa39a16ea5b3009cccdade13d5af77 100755 --- a/src/module_gtf/web_service/ws/EmailOptions.class.inc +++ b/src/module_gtf/web_service/ws/EmailOptions.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'EmailOption.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class EmailOptions extends GTF { /** diff --git a/src/module_gtf/web_service/ws/EmailTemplate.class.inc b/src/module_gtf/web_service/ws/EmailTemplate.class.inc index 489104ebec34d9274247bc7b4b4de2d52048c4ee..382d5057f4c136d8453f449e5be4b87f79c76c81 100755 --- a/src/module_gtf/web_service/ws/EmailTemplate.class.inc +++ b/src/module_gtf/web_service/ws/EmailTemplate.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file EmailTemplate.class.inc diff --git a/src/module_gtf/web_service/ws/EmailTemplates.class.inc b/src/module_gtf/web_service/ws/EmailTemplates.class.inc index 0160d88806a2a066d95f84860346acd67b15a5ec..ce06588c4f810794f34da23b89bf4346af519208 100755 --- a/src/module_gtf/web_service/ws/EmailTemplates.class.inc +++ b/src/module_gtf/web_service/ws/EmailTemplates.class.inc @@ -12,10 +12,10 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'EmailTemplate.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/Email.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/Email.class.inc'; class EmailTemplates extends GTF { /** diff --git a/src/module_gtf/web_service/ws/FmeEngine.class.inc b/src/module_gtf/web_service/ws/FmeEngine.class.inc old mode 100644 new mode 100755 index fe3ee90c9a4f658408a763c002d92aeaf3baf5ef..f51d5b2e2eef44b92fd9678e82516ddb6d8d8bda --- a/src/module_gtf/web_service/ws/FmeEngine.class.inc +++ b/src/module_gtf/web_service/ws/FmeEngine.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file FmeEngine.class.inc @@ -28,7 +28,7 @@ class FmeEngine extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("fme_engine_id", "name", "server_id", "local_path", "server_name", "fme_engine_type_id", "server_url", "login", "password", "s3_access_key_id", "s3_secret_access_key", "fme_cloud_api_token", "fme_engine_type_label", "s3_region", "iam_access_key_id", "iam_secret_access_key", 'fme_server_instance_name', 'fme_server_s3_bucket', "useexternaldbconnection"); + $this->aSelectedFields = Array("fme_engine_id", "name", "server_id", "local_path", "server_name", "fme_engine_type_id", "server_url", "login", "password", "s3_access_key_id", "s3_secret_access_key", "fme_cloud_api_token", "fme_engine_type_label", "s3_region", "iam_access_key_id", "iam_secret_access_key"); } /** @@ -68,80 +68,6 @@ class FmeEngine extends GTF { * ) */ - /** - * @SWG\Get(path="/fmeengines/{fme_engine_id}/instances/{instance_name}", - * tags={"FmeEngines"}, - * summary="Get Fme Server instance", - * description="Request to get an instance of Fme Server on Fme Cloud", - * operationId="GET", - * produces={"application/xml", "application/json", "application/x-vm-json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Parameter( - * name="fme_engine_id", - * in="path", - * description="user id", - * required=true, - * type="integer", - * format="int32" - * ), - * * @SWG\Parameter( - * name="instance_name", - * in="path", - * description="name of the fme server instance", - * required=true, - * type="string" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/fmeengines") - * ) - * ) - */ - - /** - * @SWG\Get(path="/fmeengines/{fme_engine_id}/instances/{instance_name}/info", - * tags={"FmeEngines"}, - * summary="Get Fme Server instance information", - * description="Request to get the FME Server build number and version on Fme Cloud", - * operationId="GET", - * produces={"application/xml", "application/json", "application/x-vm-json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Parameter( - * name="fme_engine_id", - * in="path", - * description="user id", - * required=true, - * type="integer", - * format="int32" - * ), - * * @SWG\Parameter( - * name="instance_name", - * in="path", - * description="name of the fme server instance", - * required=true, - * type="string" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/fmeengines") - * ) - * ) - */ - /** * get informations about mode */ diff --git a/src/module_gtf/web_service/ws/FmeEngineType.class.inc b/src/module_gtf/web_service/ws/FmeEngineType.class.inc index 0bb700fe2e6511c427f997fa42855e75e08b97b6..65d8f4e1b391741c17f3e8a0ab8b6f549416583c 100755 --- a/src/module_gtf/web_service/ws/FmeEngineType.class.inc +++ b/src/module_gtf/web_service/ws/FmeEngineType.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file FmeEngineType.class.inc diff --git a/src/module_gtf/web_service/ws/FmeEngineTypes.class.inc b/src/module_gtf/web_service/ws/FmeEngineTypes.class.inc index 1cebef5c1e17706de2380441c4d0210dd50035c9..26db4a71cfd5af02d8b295ec08e2b0f864eabf8b 100755 --- a/src/module_gtf/web_service/ws/FmeEngineTypes.class.inc +++ b/src/module_gtf/web_service/ws/FmeEngineTypes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'FmeEngineType.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class FmeEngineTypes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/FmeEngines.class.inc b/src/module_gtf/web_service/ws/FmeEngines.class.inc old mode 100644 new mode 100755 index d4c703338e423e975b5856107cc0081d2a7adbad..b62eff432a411099fa41897d0d54358659d14ddc --- a/src/module_gtf/web_service/ws/FmeEngines.class.inc +++ b/src/module_gtf/web_service/ws/FmeEngines.class.inc @@ -12,11 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'FmeEngine.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once 'gtf_lib/FmeCloud.class.inc'; -require_once 'gtf_lib/FmeServer.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class FmeEngines extends GTF { /** @@ -42,7 +40,7 @@ class FmeEngines extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("fme_engine_id", "name", "server_id", "local_path", "server_name", "fme_engine_type_id", "server_url", "login", "password", "s3_access_key_id", "s3_secret_access_key", "fme_cloud_api_token", "fme_engine_type_label", "s3_region", "iam_access_key_id", "iam_secret_access_key", 'fme_server_instance_name', 'fme_server_s3_bucket', "useexternaldbconnection"); + $this->aSelectedFields = Array("fme_engine_id", "name", "server_id", "local_path", "server_name", "fme_engine_type_id", "server_url", "login", "password", "s3_access_key_id", "s3_secret_access_key", "fme_cloud_api_token", "fme_engine_type_label", "s3_region", "iam_access_key_id", "iam_secret_access_key"); } /** @@ -122,7 +120,7 @@ class FmeEngines extends GTF { * summary="Get FmeEngine test", * description="Request to get FmeEnginetest by id", * operationId="GET", - * produces={"application/xml", "application/json", "application/x-vm-json"}, + * produces={"application/xml", "application/json"}, * @SWG\Parameter( * name="token", * in="query", @@ -158,31 +156,17 @@ class FmeEngines extends GTF { * @return FmeEngines */ function GET() { - // Instance FME Server sur Fme Cloud. - if (!empty($this->aPath[3]) && $this->aPath[3] == 'instances') { - if (empty($this->aPath[5])) { - $sMessage = $this->getFmeServerInstance($this->aPath[2], $this->aPath[4], $oFmeCloud); - return $sMessage; - } - else { - if ($this->aPath[5] == 'info') - $sMessage = $this->getFmeServerInstanceInfo($this->aPath[2], $this->aPath[4]); + $aReturn = $this->genericGet($this->aProperties['schema_gtf'], "v_fme_engine", "fme_engine_id"); + if (!empty($this->aPath[3]) && $this->aPath[3] == 'Test') { + if ($aReturn['sStatus'] == 1) { + // Test de validité de la licence FME. + $this->testFmeLicence(); + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); return $sMessage; } - } - else { - $aReturn = $this->genericGet($this->aProperties['schema_gtf'], "v_fme_engine", "fme_engine_id"); - if (!empty($this->aPath[3]) && $this->aPath[3] == 'Test') { - if ($aReturn['sStatus'] == 1) { - // Test de validité de la licence FME. - $this->testFmeLicence(); - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - return $sMessage; - } - } else - return $aReturn['sMessage']; - } + } else + return $aReturn['sMessage']; } /** @@ -191,7 +175,7 @@ class FmeEngines extends GTF { * summary="Add FmeEngine", * description="Request to add fmeengine", * operationId="POST", - * produces={"application/xml", "application/json", "application/x-vm-json"}, + * produces={"application/xml", "application/json"}, * @SWG\Parameter( * name="token", * in="formData", @@ -252,7 +236,7 @@ class FmeEngines extends GTF { * summary="Update FmeEngine", * description="Request to update FmeEngine", * operationId="PUT", - * produces={"application/xml", "application/json", "application/x-vm-json"}, + * produces={"application/xml", "application/json"}, * @SWG\Parameter( * name="token", * in="query", @@ -297,108 +281,20 @@ class FmeEngines extends GTF { * ) * ) */ - - /** - * @SWG\Put(path="/fmeengines/{fme_engine_id}/instances/{instance_name}/start", - * tags={"FmeEngines"}, - * summary="Start Fme Server instance", - * description="Request to start an instance of Fme Server on Fme Cloud", - * operationId="PUT", - * produces={"application/xml", "application/json", "application/x-vm-json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * * @SWG\Parameter( - * name="fme_engine_id", - * in="path", - * description="id of the fme engine", - * required=true, - * type="integer", - * format = "int32" - * ), - * * @SWG\Parameter( - * name="instance_name", - * in="path", - * description="name of the fme server instance", - * required=true, - * type="string" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/fmeengines") - * ) - * ) - */ - /** - * @SWG\Put(path="/fmeengines/{fme_engine_id}/instances/{instance_name}/pause", - * tags={"FmeEngines"}, - * summary="Pause Fme Server instance", - * description="Request to pause an instance of Fme Server on Fme Cloud", - * operationId="PUT", - * produces={"application/xml", "application/json", "application/x-vm-json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * * @SWG\Parameter( - * name="fme_engine_id", - * in="path", - * description="id of the fme engine", - * required=true, - * type="integer", - * format = "int32" - * ), - * * @SWG\Parameter( - * name="instance_name", - * in="path", - * description="name of the fme server instance", - * required=true, - * type="string" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/fmeengines") - * ) - * ) - */ - /** * update fmeengine * @return id of the fmeengine if ok error object if ko */ function PUT() { - if (!empty($this->aPath[3])) { - if ($this->aPath[3] == 'instances') { - switch($this->aPath[5]) { - case 'start': - $sMessage = $this->startFmeServerInstance($this->aPath[2], $this->aPath[4]); - break; - case 'pause': - $sMessage = $this->pauseFmeServerInstance($this->aPath[2], $this->aPath[4]); - break; - } - } - } - else { - $aReturn = $this->genericPut($this->aProperties['schema_gtf'], 'v_fme_engine', 'fme_engine_id'); - if ($aReturn['sStatus'] == 1) { - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - $oFmeEngine = new FmeEngine($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); - $oFmeEngine->GET(); - } else { - $sMessage = $aReturn['sMessage']; - } + $aReturn = $this->genericPut($this->aProperties['schema_gtf'], 'v_fme_engine', 'fme_engine_id'); + if ($aReturn['sStatus'] == 1) { + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + $oFmeEngine = new FmeEngine($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); + $oFmeEngine->GET(); + } else { + $sMessage = $aReturn['sMessage']; } return $sMessage; } @@ -409,7 +305,7 @@ class FmeEngines extends GTF { * summary="delete FmeEngine", * description="Request to delete FmeEngine", * operationId="DELETE", - * produces={"application/xml", "application/json", "application/x-vm-json"}, + * produces={"application/xml", "application/json"}, * @SWG\Parameter( * name="token", * in="query", @@ -437,7 +333,7 @@ class FmeEngines extends GTF { * summary="delete FmeEngine", * description="Request to delete FmeEngine", * operationId="DELETE", - * produces={"application/xml", "application/json", "application/x-vm-json"}, + * produces={"application/xml", "application/json"}, * @SWG\Parameter( * name="token", * in="query", @@ -534,203 +430,33 @@ class FmeEngines extends GTF { $this->getFmeLicence($this->aObjects[0]->aFields["local_path"]); break; case 'fme_server': + require 'gtf_lib/FmeServer.class.inc'; $oFmeServer = new FmeServer($this->aObjects[0]->aFields['server_url'], $this->aObjects[0]->aFields['login'], $this->aObjects[0]->aFields['password'], 'day', 1); $oFmeServerLicenceStatus = $oFmeServer->getLicenceStatus(); - if ($oFmeServerLicenceStatus === false) { - $this->aObjects[0]->aFields['exists'] = true; - $this->aObjects[0]->aFields['request_error'] = true; - } - else if (empty($oFmeServerLicenceStatus)) - $this->aObjects[0]->aFields['exists'] = false; + $this->aObjects[0]->aFields['exists'] = true; + if ($oFmeServerLicenceStatus->isLicenseExpired === true) + $this->aObjects[0]->aFields['expired'] = true; + else if ($oFmeServerLicenceStatus->isLicensed === false) + $this->aObjects[0]->aFields['valid'] = false; else { - $this->aObjects[0]->aFields['exists'] = true; - if ($oFmeServerLicenceStatus->isLicenseExpired === true) - $this->aObjects[0]->aFields['expired'] = true; - else if ($oFmeServerLicenceStatus->isLicensed === false) - $this->aObjects[0]->aFields['valid'] = false; - else { - // Info sur la licence de FME Server. - //$this->aObjects[0]->aFields['exists'] = true; - $this->aObjects[0]->aFields['valid'] = true; - $sExpiryDate = $oFmeServerLicenceStatus->expiryDate; - if (!empty($sExpiryDate)) - $sExpiryDate = substr($sExpiryDate, 6, 2) . '/' . substr($sExpiryDate, 4, 2) . '/' . substr($sExpiryDate, 0, 4); - $this->aObjects[0]->aFields['validity'] = $sExpiryDate; - // Info sur FME Server. - $oFmeServerInfo = $oFmeServer->getInfo(); - $this->aObjects[0]->aFields['version'] = $oFmeServerInfo->build; - $this->aObjects[0]->aFields['type'] = $oFmeServerInfo->version; - $this->aObjects[0]->aFields['host'] = parse_url($this->aObjects[0]->aFields['server_url'], PHP_URL_HOST); - } + // Info sur la licence de FME Server. + //$this->aObjects[0]->aFields['exists'] = true; + $this->aObjects[0]->aFields['valid'] = true; + $sExpiryDate = $oFmeServerLicenceStatus->expiryDate; + if (!empty($sExpiryDate)) + $sExpiryDate = substr($sExpiryDate, 6, 2) . '/' . substr($sExpiryDate, 4, 2) . '/' . substr($sExpiryDate, 0, 4); + $this->aObjects[0]->aFields['validity'] = $sExpiryDate; + // Info sur FME Server. + $oFmeServerInfo = $oFmeServer->getInfo(); + $this->aObjects[0]->aFields['version'] = $oFmeServerInfo->build; + $this->aObjects[0]->aFields['type'] = $oFmeServerInfo->version; + $this->aObjects[0]->aFields['host'] = parse_url($this->aObjects[0]->aFields['server_url'], PHP_URL_HOST); } break; + case 'fme_cloud': + error_log(print_r($this->aObjects[0]->aFields, true)); + break; } } - - /** - * Get a Fme Server instance on Fme Cloud. - * @param {number} $iFmeEngineId Id of a Fme Engine. - * @param {string} $sFmeServerInstanceName Name of a Fme Server instance on Fme Cloud. - */ - function getFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName, &$oFmeCloud = null, &$aFmeEngine = array()) { - require $this->sRessourcesFile; - $iErrorId = 17; - $sErrorMessage = ''; - // Paramètres du moteur Fme. - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['fme_engine_id'] = array('value' => $iFmeEngineId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getFmeEngine'], $aParams); - if ($this->oConnection->oBd->enErreur()) { - $iErrorId = 1; - $sErrorMessage = $this->oConnection->oBd->getBDMessage(); - } - else if ($this->oConnection->oBd->nombreLigne($oPDOresult) > 0) { - $aFmeEngine = $this->oConnection->oBd->ligneSuivante($oPDOresult); - $oFmeCloud = new FmeCloud($aFmeEngine['server_url'], $aFmeEngine['fme_cloud_api_token']); - // Liste des occurrences de FME Server. - $aFmeServerInstances = $oFmeCloud->serviceRequest('instances'); - if (!empty($aFmeServerInstances)) { - foreach($aFmeServerInstances as $oInstance) { - if ($oInstance->name == $sFmeServerInstanceName) - $oFmeServerInstance = $oInstance; - } - if (empty($oFmeServerInstance)) - $sErrorMessage = 'L\'instance FME Server "' . $sFmeServerInstanceName . '" n\'existe pas.'; - else { - $this->aFields['instance'] = $oFmeServerInstance; - } - } - else - $sErrorMessage ='Aucune instance FME Server n\'est disponible.'; - } - else - $sErrorMessage = 'Le moteur FME spécifiée n\'existe pas.'; - // Message de retour pour l'API Rest. - if (empty($sErrorMessage)) { - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - else { - $oError = new VitisError($iErrorId, $sErrorMessage); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - return $sMessage; - } - - - /** - * Start a Fme Server instance on Fme Cloud. - * @param {number} $iFmeEngineId Id of a Fme Engine. - * @param {string} $sFmeServerInstanceName Name of a Fme Server instance on Fme Cloud. - */ - function startFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName) { - $sMessage = $this->getFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName, $oFmeCloud); - $oReturn = json_decode($sMessage); - if ($oReturn->status == 1) { - // Démarrage de l'occurence si elle est en pause. - if ($oReturn->instance->state == 'PAUSED') { - if ($oFmeCloud->startInstance($oReturn->instance->id) === false) - $sErrorMessage = 'L\'instance Fme Server n\'a pu être démarrée.' ; - else { - $oFmeServerInstance = $oFmeCloud->serviceRequest('instances/' . $oReturn->instance->id); - if ($oFmeServerInstance === false) - $sErrorMessage = 'Erreur pendant le démarrage de l\'instance Fme Server.'; - else - $this->aFields = array('instance' => $oFmeServerInstance); - } - } - else if ($oReturn->instance->state == 'RUNNING') - $sErrorMessage = 'L\'instance Fme Server est déja en cours d\'exécution.'; - else if ($oReturn->instance->state == 'executing_action') - $sErrorMessage = 'Une action est en cours d\'exéution sur L\'instance Fme Server.'; - else - $sErrorMessage = $oReturn->instance->state; - // Message de retour pour l'API Rest. - if (empty($sErrorMessage)) { - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - else { - $oError = new VitisError(17, $sErrorMessage); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - } - return $sMessage; - } - - /** - * Pause a Fme Server instance on Fme Cloud. - * @param {number} $iFmeEngineId Id of a Fme Engine. - * @param {string} $sFmeServerInstanceName Name of a Fme Server instance on Fme Cloud. - */ - function pauseFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName) { - $sMessage = $this->getFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName, $oFmeCloud); - $oReturn = json_decode($sMessage); - if ($oReturn->status == 1) { - // Mise en pause de l'occurence si elle est en cours d'éxecution. - if ($oReturn->instance->state == 'RUNNING') { - if ($oFmeCloud->pauseInstance($oReturn->instance->id) === false) - $sErrorMessage = 'L\'instance Fme Server n\'a pu être arrêtée.' ; - else { - $oFmeServerInstance = $oFmeCloud->serviceRequest('instances/' . $oReturn->instance->id); - if ($oFmeServerInstance === false) - $sErrorMessage = 'Erreur pendant l\'arrêt de l\'instance Fme Server.'; - else - $this->aFields = array('instance' => $oFmeServerInstance); - } - } - else if ($oReturn->instance->state == 'PAUSED') - $sErrorMessage = 'L\'instance Fme Server est déja à l\'arrêt'; - else if ($oReturn->instance->state == 'executing_action') - $sErrorMessage = 'Une action est en cours d\'exécution sur L\'instance Fme Server.'; - else - $sErrorMessage = $oReturn->instance->state; - // Message de retour pour l'API Rest. - if (empty($sErrorMessage)) { - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - else { - $oError = new VitisError(17, $sErrorMessage); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - } - return $sMessage; - } - - /** - * Get Fme Server instance information on Fme Cloud. - * @param {number} $iFmeEngineId Id of a Fme Engine. - * @param {string} $sFmeServerInstanceName Name of a Fme Server instance on Fme Cloud. - */ - function getFmeServerInstanceInfo($iFmeEngineId, $sFmeServerInstanceName) { - $sMessage = $this->getFmeServerInstance($iFmeEngineId, $sFmeServerInstanceName, $oFmeCloud, $aFmeEngine); - $oReturn = json_decode($sMessage); - if ($oReturn->status == 1) { - $oFmeServer = new FmeServer('https://' . $oReturn->instance->public_ip, $aFmeEngine['login'], $aFmeEngine['password'], 'day', 1); - $oInstanceInfo = $oFmeServer->getInfo(); - if ($oInstanceInfo === false) - $sErrorMessage = 'Erreur pendant la requête de demande d\'information sur l\'instance Fme Server'; - else { - $oInstanceInfo->host = $oReturn->instance->instance_url; - $this->aFields = array('info' => $oInstanceInfo); - } - // Message de retour pour l'API Rest. - if (empty($sErrorMessage)) { - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - else { - $oError = new VitisError(17, $sErrorMessage); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - } - return $sMessage; - } } ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/Gtf.class.inc b/src/module_gtf/web_service/ws/Gtf.class.inc index e5711e5ed74d6269d8d5958c0dd3362e5b76a4bb..403e63b15820a54840b6f6a24e76dd3d0ec1abff 100755 --- a/src/module_gtf/web_service/ws/Gtf.class.inc +++ b/src/module_gtf/web_service/ws/Gtf.class.inc @@ -1,6 +1,6 @@ <?php -require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/ws/vitis/Vitis.class.inc"; +require_once __DIR__ . "/../vitis/Vitis.class.inc"; class GTF extends Vitis { diff --git a/src/module_gtf/web_service/ws/Gtf.class.sql.inc b/src/module_gtf/web_service/ws/Gtf.class.sql.inc old mode 100644 new mode 100755 index 724684fd24dc3c6678a3d13df317140b5edf6c46..0b57c593bea9bf4370e88ffd0b157dd289a77874 --- a/src/module_gtf/web_service/ws/Gtf.class.sql.inc +++ b/src/module_gtf/web_service/ws/Gtf.class.sql.inc @@ -23,16 +23,6 @@ $aSql['desactivateOrder'] = 'UPDATE [sSchemaGtf].order SET enabled = FALSE WHERE $aSql['getOrderPathFiles'] = 'SELECT log_url,result_url FROM [sSchemaGtf].v_order WHERE order_id = [order_id]'; $aSql['getOrderWorkspace'] = 'SELECT workspace_id FROM [sSchemaGtf].v_order WHERE order_id = [order_id] LIMIT 1'; $aSql['getOrderEngineStatus'] = 'SELECT gtf_engine.enabled FROM [sSchemaGtf]."order" LEFT JOIN [sSchemaGtf].gtf_engine ON "order".gtf_engine_id = gtf_engine.gtf_engine_id WHERE order_id = [order_id]'; -$aSql['getRunningOrders'] = 'SELECT order_id, gtf_engine_id FROM [sSchemaGtf]."order" WHERE order_status_id IN (1, 5)'; -$aSql['updateOrderStatus'] = 'UPDATE [sSchemaGtf].order SET order_status_id = [order_status_id] WHERE order_id = [order_id]'; -//$aSql['getOrdersToDelete'] = 'SELECT order_id, gtf_engine_id, order_status_id FROM [sSchemaGtf]."order" WHERE order_id IN([idList])'; -$aSql['getOrdersToDelete'] = 'SELECT fme_engine.fme_engine_type_id, "order".order_id, "order".gtf_engine_id, "order".order_status_id FROM [sSchemaGtf].order, [sSchemaGtf].gtf_engine, [sSchemaGtf].fme_engine WHERE gtf_engine.gtf_engine_id = "order".gtf_engine_id AND fme_engine.fme_engine_id = gtf_engine.fme_engine_id AND order_id IN([idList])'; -//$aSql['getOrderFmeEngine'] = 'SELECT fme_engine.fme_engine_type_id, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_cloud_api_token, fme_engine.fme_server_instance_name, server.engines_home, v_order.gtf_engine_id FROM [sSchemaGtf].v_order, [sSchemaGtf].gtf_engine, [sSchemaGtf].fme_engine, [sSchemaGtf].server WHERE gtf_engine.gtf_engine_id = v_order.gtf_engine_id AND fme_engine.fme_engine_id = gtf_engine.fme_engine_id AND server.server_id = fme_engine.server_id AND order_id = [iOrderId] LIMIT 1'; -$aSql['getGtfEngineHomeFromOrderId'] = 'SELECT engines_home, "order".gtf_engine_id, "order".order_id FROM [sSchemaGtf]."server", [sSchemaGtf].gtf_engine, [sSchemaGtf]."order" WHERE gtf_engine.server_id = "server".server_id AND gtf_engine.gtf_engine_id = "order".gtf_engine_id AND order_id = [order_id]'; -$aSql['getGtfEngineHomeFromEngineId'] = 'SELECT engines_home, "order".gtf_engine_id, "order".order_id FROM [sSchemaGtf]."server", [sSchemaGtf].gtf_engine, [sSchemaGtf]."order" WHERE gtf_engine.server_id = "server".server_id AND gtf_engine.gtf_engine_id = "order".gtf_engine_id AND gtf_engine.gtf_engine_id = [iGtfEngineId]'; -$aSql['getFmeServerOrder'] = 'SELECT fme_engine.fme_engine_type_id, fme_engine.server_url, fme_engine.login, fme_engine.password, fme_engine.fme_cloud_api_token, fme_engine.fme_server_instance_name, "order".gtf_engine_id, "order".pid, server.engines_home, "order".log_url FROM [sSchemaGtf].order, [sSchemaGtf].gtf_engine, [sSchemaGtf].fme_engine, [sSchemaGtf].server WHERE gtf_engine.gtf_engine_id = "order".gtf_engine_id AND fme_engine.fme_engine_id = gtf_engine.fme_engine_id AND server.server_id = fme_engine.server_id AND order_id = [order_id] LIMIT 1'; -$aSql['getOrderPid'] = 'SELECT fme_engine.fme_engine_type_id, "order".gtf_engine_id, "order".pid FROM [sSchemaGtf]."order", [sSchemaGtf].gtf_engine, [sSchemaGtf].fme_engine, [sSchemaGtf].server WHERE gtf_engine.gtf_engine_id = "order".gtf_engine_id AND fme_engine.fme_engine_id = gtf_engine.fme_engine_id AND server.server_id = fme_engine.server_id AND order_id = [order_id] LIMIT 1'; -$aSql['getOrderFmeEngineType'] = 'SELECT fme_engine.fme_engine_type_id FROM [sSchemaGtf]."order", [sSchemaGtf].gtf_engine, [sSchemaGtf].fme_engine WHERE gtf_engine.gtf_engine_id = "order".gtf_engine_id AND fme_engine.fme_engine_id = gtf_engine.fme_engine_id AND order_id = [order_id] LIMIT 1'; // UserSubscriptions $aSql['setSubscriptionEngineId'] = 'UPDATE [sSchemaGtf].subscription SET gtf_engine_id=[gtf_engine_id] WHERE subscription_id=[subscription_id]'; $aSql['getUserSubscriptions'] = "SELECT order_id, label_name, CASE when v_user_subscription.enabled IS TRUE THEN '<img src=''./images/true.png'' />' ELSE '<img src=''./images/false.png'' />' END as enabled, order_date, '<img src=''./images/wk_params.png'' onmouseover=''loadTooltip(event,0,0,\"White\",\"#' || order_id || '\", \"' || replace(replace(replace(replace(wk_params,'\r\n', '<br/>'),'\\','\\\\'), '\"', '\\\"'),'''', ''') || '\" )'' onmouseout=''unshow()''/>' as wk_params, period.name as order_period_libelle, v_user_subscription.email_option_id, label_id, CASE WHEN email_notifications IS NOT NULL then '<img src=''./images/enveloppe.png'' onmouseover=''showTooltip(event,500,0,\"White\",\"#' || order_id || '\", \"' || replace(email_notifications, ';', '<br>') || '\" )'' onmouseout=''unshow()''/>' END as email_notifications, translation_email_notification.translation as notification FROM [sSchemaGtf].v_user_subscription LEFT JOIN [sSchemaGtf].period ON period.period_id = v_user_subscription.period_id LEFT JOIN [sSchemaGtf].rt_email_option on rt_email_option.email_option_id = v_user_subscription.email_option_id LEFT JOIN [sSchemaFramework].vm_translation translation_email_notification ON rt_email_option.label_id = translation_email_notification.translation_id WHERE translation_email_notification.lang = '[sLang]'"; @@ -66,6 +56,4 @@ $aSql['checkUserWorkspace'] = 'SELECT * FROM [sSchemaGtf].v_user_workspace WHERE // Workspaces $aSql['getWorkspaceLastSaveData'] = 'SELECT last_save_date, last_save_build FROM [sSchemaGtf].workspace WHERE workspace_id=[workspace_id]'; $aSql['checkWorkspaceName'] = 'SELECT workspace_id FROM [sSchemaGtf].workspace WHERE name=[name]'; -// FmeEngines -$aSql['getFmeEngine'] = 'SELECT * FROM [sSchemaGtf].fme_engine WHERE fme_engine_id = [fme_engine_id]'; ?> diff --git a/src/module_gtf/web_service/ws/GtfEngine.class.inc b/src/module_gtf/web_service/ws/GtfEngine.class.inc index 6a94d7125376ddbd382053ed444bf42466456169..e68d2e3159ee255c07813c1ef874577054b60239 100755 --- a/src/module_gtf/web_service/ws/GtfEngine.class.inc +++ b/src/module_gtf/web_service/ws/GtfEngine.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * @file GtfEngine.class.inc diff --git a/src/module_gtf/web_service/ws/GtfEngines.class.inc b/src/module_gtf/web_service/ws/GtfEngines.class.inc index 0985607d4b612448a00d9435f5d1f15436274bd4..e228e21e7a8e5ae9ee19159da1820e362f714e35 100755 --- a/src/module_gtf/web_service/ws/GtfEngines.class.inc +++ b/src/module_gtf/web_service/ws/GtfEngines.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'GtfEngine.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class GtfEngines extends GTF { /** diff --git a/src/module_gtf/web_service/ws/GtfGroup.class.inc b/src/module_gtf/web_service/ws/GtfGroup.class.inc index 586bf5ce523821642afa98df36033874352b3781..b7111fdc7375d0bb5aa2dcf724752c122d620e14 100755 --- a/src/module_gtf/web_service/ws/GtfGroup.class.inc +++ b/src/module_gtf/web_service/ws/GtfGroup.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Group.class.inc diff --git a/src/module_gtf/web_service/ws/GtfGroups.class.inc b/src/module_gtf/web_service/ws/GtfGroups.class.inc index b1714a66c7fd655f407d986f79ecf2be37270d62..4be4fe11fb56ea205b585395fcf6eec97eed473c 100755 --- a/src/module_gtf/web_service/ws/GtfGroups.class.inc +++ b/src/module_gtf/web_service/ws/GtfGroups.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'GtfGroup.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class GtfGroups extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Inbox.class.inc b/src/module_gtf/web_service/ws/Inbox.class.inc index 6e4fca7780558618b3aa4ee82264067c07cb6029..5e58e5b357f8e7a384b3b681789aa2bd91a0bbf8 100755 --- a/src/module_gtf/web_service/ws/Inbox.class.inc +++ b/src/module_gtf/web_service/ws/Inbox.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Inbox.class.inc diff --git a/src/module_gtf/web_service/ws/Inboxes.class.inc b/src/module_gtf/web_service/ws/Inboxes.class.inc index 56d29daae6ec890730b8ceaffd3f28359432575d..a393ea0a40edb42e9e1d871600811416044a72d3 100755 --- a/src/module_gtf/web_service/ws/Inboxes.class.inc +++ b/src/module_gtf/web_service/ws/Inboxes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Inbox.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Inboxes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Instance.class.inc b/src/module_gtf/web_service/ws/Instance.class.inc index 0c024c1e4f3dc66891075154e46f35022ef62d2c..6d6909feee74cdb7c2364f9f7894988944b15f84 100755 --- a/src/module_gtf/web_service/ws/Instance.class.inc +++ b/src/module_gtf/web_service/ws/Instance.class.inc @@ -11,9 +11,8 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once ("gtf_lib/phpUtility.inc"); +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Instance extends GTF { /** @@ -39,20 +38,19 @@ class Instance extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('instance_id'); + $this->aSelectedFields = Array('priority_id', 'priority_label'); } /** - * @SWG\Post(path="/instance/generate", + * @SWG\Get(path="/instance/calculate", * tags={"Instance"}, - * summary="Generate a GTF instance id", - * description="Request to generate a new instance id for GTF", - * operationId="POST", + * summary="Get instance id", + * description="Request to get instance id", + * operationId="GET", * produces={"application/xml", "application/json", "application/x-vm-json"}, - * consumes= { "multipart/form-data"}, * @SWG\Parameter( * name="token", - * in="formData", + * in="query", * description="user token", * required=true, * type="string" @@ -66,16 +64,45 @@ class Instance extends GTF { */ /** - * Generate a GTF instance - * @return id of the workspace created + * get Instance + * @return Instance */ - function POST() { - if ($this->aPath[2] == 'generate') { - $this->aFields['instance_id'] = generateGtfInstanceId(); - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - return $sMessage; + function GET() { + if (!empty($this->aPath[2])) { + if ($this->aPath[2] == 'calculate') { + } } + $this->calculateGtfInstanceId(); + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; } + + /** + * Calculating a GTF instance id. + */ + function calculateGtfInstanceId() { + $aOutput = array(); + $iReturnStatus = 1; + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + // Paramètres à concaténer pour un identifiant unique par machine. + $aCommands = array( + 'NICCONFIG', // cartes réseaux (adresses MAC) + 'CPU', // modèle, vitesse, id... + 'DISKDRIVE', // N° de série... + 'MEMORYCHIP', + 'CDROM', // Lecteur DVD... + 'path win32_VideoController', // Carte vidéo + 'IDECONTROLLER', + 'SCSICONTROLLER', + 'DESKTOPMONITOR', + 'LOGON', + 'NETLOGIN' + ); + $sCommandLine = 'wmic '. implode(' & wmic ', $aCommands); + } + exec($sCommandLine, $aOutput, $iReturnStatus); + $this->aFields['instance_id'] = hash_hmac('sha256', implode(chr(20), $aOutput), uniqid('', true)); + } } ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/License.class.inc b/src/module_gtf/web_service/ws/License.class.inc index 8f1e63df69d834a2b084cc1fbf2f2c35053dd714..c38149a4fc04ede57184738bdff9282de136e40f 100755 --- a/src/module_gtf/web_service/ws/License.class.inc +++ b/src/module_gtf/web_service/ws/License.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; //require_once 'Priority.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; //require_once ("PEAR/Mail.php"); use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; diff --git a/src/module_gtf/web_service/ws/Message.class.inc b/src/module_gtf/web_service/ws/Message.class.inc index 04c94cede1a1ef2e5be0a2c15233e4cf5a9fd3cc..115aebd4fedf3726fadff14a8e2da800573c090a 100755 --- a/src/module_gtf/web_service/ws/Message.class.inc +++ b/src/module_gtf/web_service/ws/Message.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Message.class.inc @@ -28,7 +28,7 @@ class Message extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('message_id', 'messageclass', $this->getDateSelectedFields('creation_date', 'yeartosecond'), 'body', 'sender', 'messageclass_type', 'status', $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array('message_id', 'messageclass', 'creation_date', 'body', 'sender', 'messageclass_type', 'status'); } /** diff --git a/src/module_gtf/web_service/ws/MessageClass.class.inc b/src/module_gtf/web_service/ws/MessageClass.class.inc index de85c62c123085a1be27fe65629421a78ec2f74b..070494c76401e6de7ed8dc2bd6bfc44391dbd553 100755 --- a/src/module_gtf/web_service/ws/MessageClass.class.inc +++ b/src/module_gtf/web_service/ws/MessageClass.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file MessageClass.class.inc diff --git a/src/module_gtf/web_service/ws/MessageClassType.class.inc b/src/module_gtf/web_service/ws/MessageClassType.class.inc index 839d16d90f2caabb4842ad2366272bd56dc90e3f..2ad4d9343e64d2df9363231dd883bc2bb4b3da9e 100755 --- a/src/module_gtf/web_service/ws/MessageClassType.class.inc +++ b/src/module_gtf/web_service/ws/MessageClassType.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file MessageClassType.class.inc diff --git a/src/module_gtf/web_service/ws/MessageClassTypes.class.inc b/src/module_gtf/web_service/ws/MessageClassTypes.class.inc index 9d97e2a5d007994a8730a0ba3b7ccb93a42c739d..6cf8013b63e197041ffa61d3425242c7742d9364 100755 --- a/src/module_gtf/web_service/ws/MessageClassTypes.class.inc +++ b/src/module_gtf/web_service/ws/MessageClassTypes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'MessageClassType.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class MessageClassTypes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/MessageClasses.class.inc b/src/module_gtf/web_service/ws/MessageClasses.class.inc index 570da8da8925143eb1e278f442b05b3e58cd937d..c4fe9b3f1ed7285f94b516f14c1e3237b98dbe9d 100755 --- a/src/module_gtf/web_service/ws/MessageClasses.class.inc +++ b/src/module_gtf/web_service/ws/MessageClasses.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'MessageClass.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class MessageClasses extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Messages.class.inc b/src/module_gtf/web_service/ws/Messages.class.inc index 2b27d033bc4700279df9f2536335456af8c6995b..92a71bdf4d3e3d086963ba1f53ed83400980da8a 100755 --- a/src/module_gtf/web_service/ws/Messages.class.inc +++ b/src/module_gtf/web_service/ws/Messages.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Message.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Messages extends GTF { /** @@ -34,13 +34,13 @@ class Messages extends GTF { * construct * @param type $aPath url of the request * @param type $aValues parameters of the request - * @param type $properties properties - * @param type $bShortcut false to reinit variables + * @param type $properties properties + * @param type $bShortcut false to reinit variables * @param type $oConnection connection object */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('message_id', 'messageclass', $this->getDateSelectedFields('creation_date', 'yeartosecond'), 'body', 'sender', 'messageclass_type', 'status', $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array('message_id', 'messageclass', 'creation_date', 'body', 'sender', 'messageclass_type', 'status'); } /** diff --git a/src/module_gtf/web_service/ws/Order.class.inc b/src/module_gtf/web_service/ws/Order.class.inc old mode 100644 new mode 100755 index ef369ff66d1b510d308872d2e45ca844bdd65111..8bc3193b21dc8cbb2291368d538c1109aa19fadc --- a/src/module_gtf/web_service/ws/Order.class.inc +++ b/src/module_gtf/web_service/ws/Order.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Order.class.inc @@ -15,6 +15,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * */ class Order extends GTF { + public $oError; /** @@ -27,7 +28,7 @@ class Order extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("order_id", "priority_id", "workspace_id", "workspace_key", "label_name", "order_status_id", "user_id", "login", "period_id", "order_period_libelle", "wk_params", "result_url", $this->getDateSelectedFields('order_date', 'yeartosecond'), "log_url", $this->getDateSelectedFields('execution_date', 'yeartosecond'), "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "email_option_label", $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array("order_id", "priority_id", "workspace_id", "workspace_key", "label_name", "order_status_id", "user_id", "login", "period_id", "order_period_libelle", "wk_params", "result_url", "order_date", "log_url", "execution_date", "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "priority_label", "email_option_label"); } /** diff --git a/src/module_gtf/web_service/ws/OrderStatus.class.inc b/src/module_gtf/web_service/ws/OrderStatus.class.inc index 15313451ffa92a18fa3190aee5a536d00d2b7b81..ddfe37ff541107538ecdf796f642a9c062f0ca72 100755 --- a/src/module_gtf/web_service/ws/OrderStatus.class.inc +++ b/src/module_gtf/web_service/ws/OrderStatus.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file OrderStatus.class.inc diff --git a/src/module_gtf/web_service/ws/OrderStatutes.class.inc b/src/module_gtf/web_service/ws/OrderStatutes.class.inc index eb8f463c42acfa446b980f0b4d4a507b6144d02c..dbb56fb47db66142272545d092bc30a2cf831ae3 100755 --- a/src/module_gtf/web_service/ws/OrderStatutes.class.inc +++ b/src/module_gtf/web_service/ws/OrderStatutes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'OrderStatus.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class OrderStatutes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Orders.class.inc b/src/module_gtf/web_service/ws/Orders.class.inc index c3142fb17ae5c8e40a2c483535967333fadd400b..53ce8af5d9d248f72806d1bec478fc1b9b1a9890 100644 --- a/src/module_gtf/web_service/ws/Orders.class.inc +++ b/src/module_gtf/web_service/ws/Orders.class.inc @@ -12,11 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Order.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once 'gtf_lib/FmeServer.class.inc'; -require_once 'gtf_lib/FmeCloud.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Orders extends GTF { /** @@ -42,7 +40,7 @@ class Orders extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("order_id", "priority_id", "workspace_id", "workspace_key", "label_name", "order_status_id", "user_id", "login", "period_id", "order_period_libelle", "wk_params", "result_url", $this->getDateSelectedFields('order_date', 'yeartosecond'), "log_url", $this->getDateSelectedFields('execution_date', 'yeartosecond'), "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "email_option_label", "order_status_label", "concat(gtf_engine_id, ' - ', name) as name", $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array("order_id", "priority_id", "workspace_id", "workspace_key", "label_name", "order_status_id", "user_id", "login", "period_id", "order_period_libelle", "wk_params", "result_url", "to_char(order_date, 'YYYY-MM-DD HH24:MI:SS') as order_date", "log_url", "to_char(execution_date, 'YYYY-MM-DD HH24:MI:SS') as execution_date", "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "priority_label", "email_option_label", "order_status_label", "concat(gtf_engine_id, ' - ', name) as name"); } /** @@ -118,47 +116,19 @@ class Orders extends GTF { * ) */ - /** - * @SWG\Get(path="/orders/running", - * tags={"Orders"}, - * summary="Get running orders", - * description="Request to get all the running orders", - * operationId="GET", - * produces={"application/xml", "application/json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Response( - * response=200, - * description="Properties Response", - * @SWG\Schema(ref="#/definitions/orders") - * ) - * ) - */ - /** * get Orders * @return Orders */ function GET() { - if (!empty($this->aPath[2]) && $this->aPath[2] == "running") - $sMessage = $this->getRunningOrders(); + if (in_array('gtf_admin', $this->oConnection->aPrivileges) || in_array('gtf_author', $this->oConnection->aPrivileges)) + $aReturn = $this->genericGet($this->aProperties['schema_gtf'], "v_order_fast", "order_id"); else { - if (in_array('gtf_admin', $this->oConnection->aPrivileges)) - $aReturn = $this->genericGet($this->aProperties['schema_gtf'], "v_order_fast", "order_id"); - else { - $oError = new VitisError(12, "You don't have the rights to get orders"); - $aXmlRacineAttribute['status'] = 0; - $aReturn = array(); - $aReturn['sMessage'] = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - $sMessage = $aReturn['sMessage']; + $oError = new VitisError(12, "You don't have the rights to get orders"); + $aXmlRacineAttribute['status'] = 0; + $aReturn['sMessage'] = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - return $sMessage; + return $aReturn['sMessage']; } /** @@ -282,62 +252,19 @@ class Orders extends GTF { * ) */ - /** - * @SWG\Put(path="/orders/{order_id}/stop", - * tags={"Orders"}, - * summary="Stop order", - * description="Request to stop an order", - * operationId="PUT", - * produces={"application/xml", "application/json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Parameter( - * name="order_id", - * in="path", - * description="Order id", - * required=true, - * type="integer", - * format = "int32" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/orders") - * ) - * ) - */ - /** * update order */ function PUT() { if (!empty($this->aPath[2])) { - if (!empty($this->aPath[3])) { - // Arrêt d'une demande en cours. - if ($this->aPath[3] == 'stop') - $aReturn = $this->stopFmeOrder($this->aValues["my_vitis_id"]); - } - else { - switch ($this->aPath[2]) { - case 'gtfengine': - $aReturn = $this->setOrderGtfEngine(); - break; - case 'reset': - $aReturn = $this->resetOrder(); - break; - case 'activate': - $aReturn = $this->activateOrder(); - break; - case 'desactivate': - $aReturn = $this->desactivateOrder(); - break; - } - } + if ($this->aPath[2] == "gtfengine") + $aReturn = $this->setOrderGtfEngine(); + else if ($this->aPath[2] == "reset") + $aReturn = $this->resetOrder(); + else if ($this->aPath[2] == "activate") + $aReturn = $this->activateOrder(); + else if ($this->aPath[2] == "desactivate") + $aReturn = $this->desactivateOrder(); $aXmlRacineAttribute['status'] = $aReturn['status']; if ($aReturn['status'] == 1) $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); @@ -484,9 +411,6 @@ class Orders extends GTF { $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } } else { - // Stoppe les demandes en cours (Fme Server -> supprime le traitement et le répertoire des données). - $this->deleteFmeOrders(); - // $aReturn = $this->genericDelete($this->aProperties['schema_gtf'], 'order', 'order_id'); $sMessage = $aReturn['sMessage']; } @@ -541,20 +465,6 @@ class Orders extends GTF { */ function resetOrder() { require $this->sRessourcesFile; - // Supprime l'ancien résultat. - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['idList'] = array('value' => $this->aValues['idList'], 'type' => 'group'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getOrders'], $aParams); - if ($this->oConnection->oBd->enErreur()) - $aReturn = array('status' => 0, 'message' => $this->oConnection->oBd->getBDMessage(), 'error_code' => 1); - else { - while ($aDemande = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { - $aFolder = explode("/", $aDemande['log_url']); - $sFolder = $this->aProperties['dir_export'] . "/gtf/" . $aFolder[0]; - clearDir($sFolder); - } - } - // Réinitialise la demande. $aOrderId = explode('|', $this->aValues['idList']); foreach ($aOrderId as $iOrderId) { // Vérifie si le moteur déja assigné est actif. @@ -619,6 +529,7 @@ class Orders extends GTF { * \param $sTable Name of the table. * \param $iWorkspaceId Identifier of the treatment. */ + function getIdEngine($iUserOrderId, $sTable, $iWorkspaceId) { require $this->sRessourcesFile; // Récupération de l'algorithme @@ -677,330 +588,5 @@ class Orders extends GTF { } return $iEngine; } - - /** - * function getRunningOrders - */ - function getRunningOrders() { - require $this->sRessourcesFile; - // Liste des demandes. - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getRunningOrders'], $aParams); - if ($this->oConnection->oBd->enErreur()) { - $oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); - $aXmlRacineAttribute['status'] = 0; - $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - else { - $aOrders = array(); - while ($aOrder = $this->oConnection->oBd->ligneSuivante($oPDOresult)) - $aOrders['orders'][] = $aOrder['order_id']; - $this->aFields = $aOrders; - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } - return $sMessage; - } - - /** - * function deleteFmeOrders - */ - function deleteFmeOrders() { - require $this->sRessourcesFile; - // Infos des demandes à supprimer. - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['idList'] = array('value' => $this->aValues['idList'], 'type' => 'group'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getOrdersToDelete'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - while ($aDemande = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { - $aRunningJob = array(); - if ($aDemande['order_status_id'] == 5) { - // Paramètres de la demande si c'est un traitement asynchrone sur Fme server. - if ($aDemande['fme_engine_type_id'] != "desktop") { - $aRunningJobs = $this->getFmeServerRunningJobs($aDemande['gtf_engine_id']); - $aRunningJob = $this->getFmeServerRunningJob($aDemande['order_id'], $aRunningJobs); - } - // Stoppe la demande en cours. - $this->stopFmeOrder($aDemande['order_id']); - } - // Supprime le traitement sur Fme Server. - if ($aDemande['fme_engine_type_id'] != "desktop") - $this->deleteFmeServerOrder($aDemande['order_id'], $aDemande['gtf_engine_id'], $aRunningJob); - } - } - } - - /** - * function deleteFmeServerOrder - * \param $iOrderId Id of the Gtf order. - * \param $iGtfEngineId Id of the Gtf engine. - * \param $aRunningJob A running job on Fme Server. - */ - function deleteFmeServerOrder($iOrderId, $iGtfEngineId, $aRunningJob = array()) { - $sEngineLogFilePath = $this->aProperties['vas_home'] . '/log/engines/' . date($this->aProperties['log_period']) . '/engine_' . $iGtfEngineId . '/engine.log'; - if (!empty($aRunningJob)) { - // Demande en cours -> informations de connexion sur Fme Server dans la liste des traitements asynchrones. - $sFmeServerUrl = $aRunningJob['fme_server_url']; - $sLogin = $aRunningJob['login']; - $sPassword = $aRunningJob['password']; - $sResource = $aRunningJob['resource']; - $sPath = $aRunningJob['path']; - $iJobId = $aRunningJob['job_id']; - } - else { - // Demande en attente ou terminée -> informations de connexion sur Fme Server dans la base. - require $this->sRessourcesFile; - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['order_id'] = array('value' => $iOrderId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getFmeServerOrder'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aOrder = $this->oConnection->oBd->ligneSuivante($oPDOresult); - require $aOrder['engines_home'] . '/' . 'string.inc'; - // Si Fme Cloud -> l'instance de Fme Server doit être démarrée. - if ($aOrder['fme_engine_type_id'] == 'fme_cloud') { - // Ip de l'instance Fme Server. - $oFmeCloud = new FmeCloud($aOrder['server_url'], $aOrder['fme_cloud_api_token']); - $oFmeCloud->sLogFilePath = $sEngineLogFilePath; - // Adresse Ip publique de l'instance de FME Server. - $aFmeServerInstances = $oFmeCloud->serviceRequest('instances'); - if (!empty($aFmeServerInstances)) { - foreach($aFmeServerInstances as $oInstance) { - if ($oInstance->name == $aOrder['fme_server_instance_name']) - $oFmeServerInstance = $oInstance; - } - if (empty($oFmeServerInstance)) { - // Aucune instace active. - writeToLog(INFO_FME_CLOUD_INSTANCE_NOT_FOUND, $sEngineLogFilePath); - } - else { - // Statut de l'instance. - writeToLog(INFO_FME_CLOUD_INSTANCE_STATUS . $oFmeServerInstance->state, $sEngineLogFilePath); - $sFmeServerUrl = 'https://' . $oFmeServerInstance->public_ip; - // Pas de suppression possible si l'instance n'est pas démarrée. - if ($oFmeServerInstance->state != "RUNNING") - return false; - } - } - } - $sLogin = $aOrder['login']; - $sPassword = $aOrder['password']; - $sResource = 'FME_SHAREDRESOURCE_TEMP'; - if (!empty($aOrder['log_url'])) - $sPath = dirname($this->aProperties["gtf_instance_id"] . '/' . pathinfo($aOrder['log_url'], PATHINFO_DIRNAME)); - $iJobId = $aOrder['pid']; - } - } - // Suppression du traitement et du répertoire sur Fme Server. - if (!empty($sFmeServerUrl) && !empty($sLogin) && !empty($sPassword)) { - $oFmeServer = new FmeServer($sFmeServerUrl, $sLogin, $sPassword); - $oFmeServer->sLogFilePath = $sEngineLogFilePath; - if (!empty($iJobId)) - if ($oFmeServer->deleteJob($iJobId) === false) - return false; - // Supprime le répertoire des ressources de la demande sur Fme Server. - if (!empty($sResource) && !empty($sPath)) - if ($oFmeServer->serviceRequest('resources/connections/' . $sResource . '/filesys/' . $sPath, 'delete') === false) - return false; - } - } - - /** - * function stopFmeOrder - * \param $iOrderId Id of the Gtf order. - */ - function stopFmeOrder($iOrderId) { - require $this->sRessourcesFile; - // Informations de la demande à stopper. - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['order_id'] = array('value' => $iOrderId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getOrderFmeEngineType'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aOrder = $this->oConnection->oBd->ligneSuivante($oPDOresult); - if ($aOrder['fme_engine_type_id'] == 'desktop') { - if ($this->stopFmeDesktopOrderProcess($iOrderId) === false) - $sErrorMessage = ERROR_0037; - } - else { - if ($this->stopFmeServerOrder($iOrderId) === false) - $sErrorMessage = ERROR_0038; - } - // Message de retour pour l'API Rest. - if (empty($sErrorMessage)) { - $aReturn = array('status' => 1, 'message' => ''); - // Mise à jour du statut de la demande (stoppé). - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['order_id'] = array('value' => $iOrderId, 'type' => 'number'); - $aParams['order_status_id'] = array('value' => 7, 'type' => 'number'); - $this->oConnection->oBd->executeWithParams($aSql['updateOrderStatus'], $aParams); - } - else - $aReturn = array('status' => 0, 'message' => $sErrorMessage, 'error_code' => 17); - return $aReturn; - } - } - - /** - * function stopFmeDesktopOrderProcess - * \param $iOrderId Id of the Gtf order. - */ - function stopFmeDesktopOrderProcess($iOrderId) { - require $this->sRessourcesFile; - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['order_id'] = array('value' => $iOrderId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getGtfEngineHomeFromOrderId'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aGtfEngineHome = $this->oConnection->oBd->ligneSuivante($oPDOresult); - $sPidFilePath = $aGtfEngineHome['engines_home'] . '/' . 'pid_' . $aGtfEngineHome['gtf_engine_id'] . '.txt'; - if (file_exists($sPidFilePath)) { - $iPid = file_get_contents($sPidFilePath); - if (is_numeric($iPid)) { - if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { - // Supprime le processus "engine.exe". - $this->killProcess($iPid); - // Tue tous les processus liés à une demande et un traitement sur Fme Desktop. - $aProcessName = array('cmd.exe', 'php.exe', 'cmd.exe', 'fme.exe'); - foreach ($aProcessName as $sProcessName) { - $iPid = $this->getChildProcess($iPid, $sProcessName); - if ($iPid !== false) - $this->killProcess($iPid); - } - } - else { - // Supprime tous les processus enfants. - $aResult = array(); - $sResultCommande = exec('pkill -9 -P ' . $iPid, $aResult, $iResult); - // Supprime le processus du moteur. - $this->killProcess($iPid); - } - } - // Suppression du fichier contenant le pid du processus "engine.exe". - unlink($sPidFilePath); - } - } - } - - /** - * function killProcess - * \param $iPid Id of the process. - */ - function killProcess($iPid) { - $aResult = array(); - if (strtolower(substr(PHP_OS, 0, 3)) == 'win') - $sResultCommande = exec('taskkill /PID ' . $iPid . ' /F', $aResult, $iResult); - else - $sResultCommande = exec('kill ' . $iPid, $aResult, $iResult); - // Log si erreur. - if ($iResult !== 0) - writeToErrorLog(ERROR_0035 . ' (pid = ' . $iPid . ').'); - } - - /** - * function getChildProcess - * \param $iParentPid Id of the parent process. - * \param $sProcessName Name of the process. - */ - function getChildProcess($iParentPid, $sProcessName) { - $aResult = array(); - if (strtolower(substr(PHP_OS, 0, 3)) == 'win') - $sResultCommande = exec('wmic process where "ParentProcessId=' . $iParentPid . ' AND Name=\'' . $sProcessName . '\'" get ProcessId', $aResult, $iResult); - //else - //$sResultCommande = exec('' . $iParentPid, $aResult, $iResult); - //ps -o ppid= - // Log si erreur. - if ($iResult !== 0) - writeToErrorLog(ERROR_0036 . ' (pid = ' . $iPid . ').'); - else if ($iResult == 0 && !empty($aResult) && is_numeric($aResult[1])) - return $aResult[1]; - else - return false; - } - - /** - * function stopFmeServerOrder - * \param $iOrderId Id of the Gtf order. - */ - function stopFmeServerOrder($iOrderId) { - require $this->sRessourcesFile; - // Récupère le répertoire des moteurs de GTF. - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['order_id'] = array('value' => $iOrderId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getGtfEngineHomeFromOrderId'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aGtfEngineHome = $this->oConnection->oBd->ligneSuivante($oPDOresult); - // Stoppe le traitement sur Fme Server. - $sAsyncOrdersFilePath = $aGtfEngineHome['engines_home'] . '/' . 'gtf_engine' . $aGtfEngineHome['gtf_engine_id'] . '_jobid.txt'; - if (file_exists($sAsyncOrdersFilePath)) { - $aRunningJobs = unserialize(file_get_contents($sAsyncOrdersFilePath)); - $aRunningJob = $this->getFmeServerRunningJob($iOrderId, $aRunningJobs); - if ($aRunningJob !== false && !empty($aRunningJob['job_id'])) { - $sEngineLogFilePath = $this->aProperties['vas_home'] . '/log/engines/' . date($this->aProperties['log_period']) . '/engine_' . $aGtfEngineHome['gtf_engine_id'] . '/engine.log'; - $oFmeServer = new FmeServer($aRunningJob['fme_server_url'], $aRunningJob['login'], $aRunningJob['password'], 'day', 1); - $oFmeServer->sLogFilePath = $sEngineLogFilePath; - $oFmeServer->stopJob($aRunningJob['job_id']); - // Supprime le traitement dans la liste des demandes asynchrones. - $iJobIndex = null; - foreach ($aRunningJobs as $iIndex => $aRunningJob) { - if ($aRunningJob['order_id'] == $iOrderId) { - $iJobIndex = $iIndex; - break; - } - } - if ($iJobIndex !== null) { - // Sauve la liste des demandes asynchrones en cours. - $aRunningJob = array_splice($aRunningJobs, $iJobIndex, 1)[0]; - if (empty($aRunningJobs)) - unlink($sAsyncOrdersFilePath); - else - file_put_contents($sAsyncOrdersFilePath, serialize($aRunningJobs)); - // Log. - require $aGtfEngineHome['engines_home'] . '/' . 'string.inc'; - writeToLog(INFO_FME_SERVER_ASYNCHRONOUS_JOB_REMOVED_FROM_LIST . " (demande $iOrderId).", $sEngineLogFilePath); - } - } - } - } - } - - /** - * Retourne les infos d'un traitement asynchrones en cours d'exécution. - * @param {number} $iOrderId I de la demande en cours. - * @param {array} $aRunningJobs Tableau contenant la liste des traitements asynchrones en cours d'exécution. - * return array - */ - function getFmeServerRunningJob($iOrderId, $aRunningJobs) { - foreach ($aRunningJobs as $aRunningJob) { - if ($aRunningJob['order_id'] == $iOrderId) - return $aRunningJob; - } - return false; - } - - /** - * Retourne la liste des traitements asynchrones en cours d'exécution d'un moteur GTF. - * @param {number} $iGtfEngineId Id du moteur GTF. - * return array - */ - function getFmeServerRunningJobs($iGtfEngineId) { - require $this->sRessourcesFile; - // Récupère le répertoire des moteurs de GTF. - $aRunningJobs = array(); - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['iGtfEngineId'] = array('value' => $iGtfEngineId, 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getGtfEngineHomeFromEngineId'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aGtfEngineHome = $this->oConnection->oBd->ligneSuivante($oPDOresult); - $sAsyncOrdersFilePath = $aGtfEngineHome['engines_home'] . '/' . 'gtf_engine' . $aGtfEngineHome['gtf_engine_id'] . '_jobid.txt'; - if (file_exists($sAsyncOrdersFilePath)) - $aRunningJobs = unserialize(file_get_contents($sAsyncOrdersFilePath)); - } - return $aRunningJobs; - } } ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/Period.class.inc b/src/module_gtf/web_service/ws/Period.class.inc index f6db78daf01b565f1f54421cc0d877ae62cba1e5..6d1e2f9c67117ff23a2dccff1c13726795531bea 100755 --- a/src/module_gtf/web_service/ws/Period.class.inc +++ b/src/module_gtf/web_service/ws/Period.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * This class defines operation for one Period diff --git a/src/module_gtf/web_service/ws/Periods.class.inc b/src/module_gtf/web_service/ws/Periods.class.inc index 3801fcd51df10fa99460cfe9609be61e80f3b2ad..ea18edda63b45f93c02914229eea5cd71e5680d2 100755 --- a/src/module_gtf/web_service/ws/Periods.class.inc +++ b/src/module_gtf/web_service/ws/Periods.class.inc @@ -1,9 +1,9 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Period.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; /** * \file Periods.class.inc diff --git a/src/module_gtf/web_service/ws/Priorities.class.inc b/src/module_gtf/web_service/ws/Priorities.class.inc index dcc02aa8f2ddd40bc1b916f1b1d30f8dc4623005..5ca36af17580fa203fc68c6e65e275f80921f805 100755 --- a/src/module_gtf/web_service/ws/Priorities.class.inc +++ b/src/module_gtf/web_service/ws/Priorities.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Priority.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Priorities extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Priority.class.inc b/src/module_gtf/web_service/ws/Priority.class.inc index 063bc42ea71b37d1943a75f2e107e72095ee53de..f744848365a92de070dc49d1ef0b7e024794d96c 100755 --- a/src/module_gtf/web_service/ws/Priority.class.inc +++ b/src/module_gtf/web_service/ws/Priority.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Priority.class.inc diff --git a/src/module_gtf/web_service/ws/SchemaGroup.class.inc b/src/module_gtf/web_service/ws/SchemaGroup.class.inc deleted file mode 100755 index 6dc50604e1b053f0ce4ba912fbf27361e25d1054..0000000000000000000000000000000000000000 --- a/src/module_gtf/web_service/ws/SchemaGroup.class.inc +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; - -/** - * \file SchemaGroup.class.inc - * \class SchemaGroup - * - * \author Sofian Pujo <Sofian.pujo@veremes.com>. - * - * \brief This file contains the SchemaGroup php class - * - * This class defines operation for one SchemaGroup - * - */ -class SchemaGroup extends GTF { - - public $oError; - - /** - * construct - * @param type $aPath url of the request - * @param type $aValues parameters of the request - * @param type $properties properties - * @param type $bShortcut false to reinit variables - * @param type $oConnection connection object - */ - function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { - parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('group_id', 'schema_group_id', 'schema', 'id_schema'); - } - - /** - * get SchemaGroup - * @return SchemaGroup - */ - function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_contraintes'], "schema", "id_schema"); - $this->getSchemas(); - } - - /** - * get schemas of group - */ - function getSchemas() { - $this->sRessourcesFile = "ws/gtf/SchemaGroups.class.sql.inc"; - require $this->sRessourcesFile; - if (in_array("id_schema", $this->aSelectedFields)) { - $aParams['sSchemaContraintes'] = array('value' => $this->aProperties['schema_contraintes'], 'type' => 'schema_name'); - $aParams['group_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); - //Requête pour récupérer les schémas - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getSchemas'], $aParams); - $sListSchemaId = ""; - $aListSchemaName = array(); - //Formation du tableau pour les schémas - while ($aLigne = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { - if ($sListSchemaId == "") { - $sListSchemaId = $aLigne["id_schema"]; - } else { - $sListSchemaId .= "|" . $aLigne["id_schema"]; - } - $aListSchemaName[] = $aLigne["name"]; - } - $oPDOresult = $this->oConnection->oBd->fermeResultat(); - $this->aFields['group_schema'] = $sListSchemaId; - $this->aFields['group_schema_label'] = implode(',', $aListSchemaName); - } - } - -} - -?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/SchemaGroups.class.inc b/src/module_gtf/web_service/ws/SchemaGroups.class.inc deleted file mode 100755 index d0dfd66527b74e82d96ecc015bea94d8202b35eb..0000000000000000000000000000000000000000 --- a/src/module_gtf/web_service/ws/SchemaGroups.class.inc +++ /dev/null @@ -1,184 +0,0 @@ -<?php - -/** - * \file SchemaGroups.class.inc - * \class SchemaGroups - * - * \author Sofian Pujo <sofian.pujo@veremes.com>. - * - * \brief This file contains the SchemaGroups php class - * - * This class defines Rest Api to Gtf schemagroups - * - */ -require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once 'SchemaGroup.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; - -class SchemaGroups extends GTF { - /** - * @SWG\Definition( - * definition="/schemagroups", - * allOf={ - * @SWG\Schema(ref="#/definitions/schemagroups") - * } - * ) - * * @SWG\Tag( - * name="SchemaGroups", - * description="Operations about SchemaGroups" - * ) - */ - - /** - * construct - * @param type $aPath url of the request - * @param type $aValues parameters of the request - * @param type $properties properties - * @param type $bShortcut false to reinit variables - * @param type $oConnection connection object - */ - function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { - parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('group_id', 'id_schema', 'schema_group_id', 'schema'); - } - - /** - * @SWG\Get(path="/schemagroups", - * tags={"SchemaGroups"}, - * summary="Get SchemaGroups", - * description="Request to get SchemaGroups", - * operationId="GET", - * produces={"application/xml", "application/json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Parameter( - * name="order_by", - * in="query", - * description="list of ordering fields", - * required=false, - * type="string" - * ), - * @SWG\Parameter( - * name="sort_order", - * in="query", - * description="sort order", - * required=false, - * type="string" - * ), - * @SWG\Parameter( - * name="limit", - * in="query", - * description="number of element", - * required=false, - * type="integer", - * format="int32" - * ), - * @SWG\Parameter( - * name="offset", - * in="query", - * description="index of first element", - * required=false, - * type="string", - * format="int32" - * ), - * @SWG\Parameter( - * name="attributs", - * in="query", - * description="list of attributs", - * required=false, - * type="string" - * ), - * @SWG\Parameter( - * name="filter", - * in="query", - * description="filter results", - * required=false, - * type="string" - * ), - * @SWG\Parameter( - * name="distinct", - * in="query", - * description="delete duplicates", - * required=false, - * type="boolean" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/schemagroups") - * ) - * ) - */ - - /** - * get SchemaGroups - * @return SchemaGroups - */ - function GET() { - $aReturn = $this->genericGet($this->aProperties['schema_contraintes'], "v_schema_group", "id_schema"); - return $aReturn['sMessage']; - } - - /** - * @SWG\Put(path="/schemagroups", - * tags={"SchemaGroups"}, - * summary="Put SchemaGroups", - * description="Request to Put SchemaGroups", - * operationId="Put", - * produces={"application/xml", "application/json"}, - * @SWG\Parameter( - * name="token", - * in="query", - * description="user token", - * required=true, - * type="string" - * ), - * @SWG\Parameter( - * name="distinct", - * in="query", - * description="delete duplicates", - * required=false, - * type="boolean" - * ), - * @SWG\Response( - * response=200, - * description="Poprerties Response", - * @SWG\Schema(ref="#/definitions/schemagroups") - * ) - * ) - */ - - /** - * Put SchemaGroups - * @return SchemaGroups - */ - function PUT() { - - $this->sRessourcesFile = "ws/gtf/SchemaGroups.class.sql.inc"; - require $this->sRessourcesFile; - $aReturn = $this->genericPut($this->aProperties['schema_contraintes'], 'v_schema_group', 'id_schema'); - //Suppression de tous les schémas dans la table - $this->oConnection->oBd->delete($this->aProperties['schema_contraintes'], 'v_schema_group', 'group_id', $this->aValues["my_vitis_id"]); - - if (!empty($this->aValues['group_schema'])) { - $aSchemas = explode('|', $this->aValues['group_schema']); - foreach ($aSchemas as $iSchemaId) { - $aParams['sSchemaContraintes'] = array('value' => $this->aProperties['schema_contraintes'], 'type' => 'schema_name'); - $aParams['group_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); - $aParams['id_schema'] = array('value' => $iSchemaId, 'type' => 'string'); - //Enregistrement des schémas dans la table - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['insertGroupSchema'], $aParams); - } - } - return $aReturn['sMessage']; - } - -} - -?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/SchemaGroups.class.sql.inc b/src/module_gtf/web_service/ws/SchemaGroups.class.sql.inc deleted file mode 100755 index 48ed4cd432408df3237526955155923d604a7a61..0000000000000000000000000000000000000000 --- a/src/module_gtf/web_service/ws/SchemaGroups.class.sql.inc +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -//Définition des requêtes de l'api Vitis -$aSql['insertGroupSchema'] = "INSERT INTO [sSchemaContraintes].v_schema_group(id_schema, group_id, schema_group_id) VALUES([id_schema], [group_id], nextval('[sSchemaContraintes].seq_qualigeo'))"; -$aSql['getSchemas'] = "SELECT id_schema FROM [sSchemaContraintes].v_schema_group WHERE group_id = [group_id]"; -$aSql['getAllSchemas'] = "SELECT DISTINCT id_schema FROM [sSchemaContraintes].schema"; -?> diff --git a/src/module_gtf/web_service/ws/Server.class.inc b/src/module_gtf/web_service/ws/Server.class.inc index f21f596b36a5ba8c1d36e7d46628b9632fa1d208..53c248683aa6a78226587d2602b785993168109b 100755 --- a/src/module_gtf/web_service/ws/Server.class.inc +++ b/src/module_gtf/web_service/ws/Server.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Server.class.inc diff --git a/src/module_gtf/web_service/ws/ServerClass.class.inc b/src/module_gtf/web_service/ws/ServerClass.class.inc index ccae65b8cc0d5d942a28a336eefc35db68d13e26..06ee850b9e2ff4ddc2c0148cc13b6c9cd29f9abd 100755 --- a/src/module_gtf/web_service/ws/ServerClass.class.inc +++ b/src/module_gtf/web_service/ws/ServerClass.class.inc @@ -1,225 +1,196 @@ -<?php - -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/dbUtil.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/logUtil.inc'; - -class ServerClass { - - //Chemin du fichier crontab - var $sCrontabFile; - //Id du server - var $iId; - //Nom du server - var $sServerName; - //Ancien nom du server - var $sOldServerName; - //Répertoire racine - var $sGtfHome; - //Répertoire Engines - var $EnginesHome; - //Objet de labase de données - var $oBd; - - function __construct($iId, $oBd, $sGtfHome, $sOldServerName = "", $aProperties = array()) { - $this->iId = $iId; - $this->oBd = $oBd; - $this->sOldServerName = $sOldServerName; - $this->sGtfHome = $sGtfHome; - $this->aProperties = $aProperties; - $this->setValues($iId); - } - - function setValues($iId) { - if ($iId != "") { - $sSql = 'SELECT scheduler_network_home, hostname, engines_home FROM ' . $this->aProperties['schema_gtf'] . '.server where server_id=[iIdServer]'; - $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - $oServer = $this->oBd->objetSuivant($oPDOresult); - $this->sCrontabFile = $oServer->scheduler_network_home; - $this->sServerName = $oServer->hostname; - $this->EnginesHome = $oServer->engines_home; - if ($this->sOldServerName == "") { - $this->sOldServerName = $this->sServerName; - } - } - } - - function deleteCrontabValuesEngine() { - $aValuesPycronNewFile = Array(); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - if (is_file($sCronFile)) { - $aPycronValues = file($sCronFile); - $bWrite = true; - foreach ($aPycronValues as $sPycronValue) { - $sPycronValue = str_replace("\n", "", $sPycronValue); - $sPycronValue = str_replace("\r", "", $sPycronValue); - if ($sPycronValue == "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - - $bWrite = false; - } else if ($sPycronValue == "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - $bWrite = true; - } - if ($bWrite == true && $sPycronValue != "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - $aValuesPycronNewFile[] = $sPycronValue; - } - } - } - // On écrit dans le fichier texte - $sFichierCrontab = fopen($sCronFile, "w"); - // Le fichier texte est vidé - ftruncate($sFichierCrontab, 0); - $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); - $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); - foreach ($aValuesPycronNewFile as $sPycronValues2) { - fputs($sFichierCrontab, $sPycronValues2 . "\n"); - } - // Enfin fermer le fichier - fclose($sFichierCrontab); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function deleteCrontabValuesSubscription() { - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $aPycronValues = file($sCronFile); - $aValuesPycronNewFile = Array(); - $bWrite = true; - foreach ($aPycronValues as $sPycronValue) { - $sPycronValue = str_replace("\n", "", $sPycronValue); - $sPycronValue = str_replace("\r", "", $sPycronValue); - - if ($sPycronValue == "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - - $bWrite = false; - } else if ($sPycronValue == "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - $bWrite = true; - } - if ($bWrite == true && $sPycronValue != "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - $aValuesPycronNewFile[] = $sPycronValue; - } - } - // On écrit dans le fichier texte - $sFichierCrontab = fopen($sCronFile, "w"); - // Le fichier texte est vidé - ftruncate($sFichierCrontab, 0); - $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); - $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); - foreach ($aValuesPycronNewFile as $sPycronValues2) { - fputs($sFichierCrontab, $sPycronValues2 . "\n"); - } - // Enfin fermer le fichier - fclose($sFichierCrontab); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddCrontabValuesEngines($sNotInList = "") { - if ($sNotInList == "") { - $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer]'; - } else { - $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer] AND gtf_engine_id not in ([sNotInList])'; - $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); - } - $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $sFichierCrontab = fopen($sCronFile, "a"); - - fputs($sFichierCrontab, "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - while ($oGTF = $this->oBd->objetSuivant($oPDOresult)) { - if ($oGTF->enabled == true) { - $sActif = ""; - } else { - $sActif = "#"; - } - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $sLigne = $sActif . "*/" . $oGTF->period . " * * * * \"" . $this->EnginesHome . "/engine.exe\" " . $oGTF->gtf_engine_id; - } else { - $sLigne = $sActif . "*/" . $oGTF->period . " * * * * cd \"" . $this->EnginesHome . "\" && \"" . $this->EnginesHome . "/engine\" " . $oGTF->gtf_engine_id; - } - fputs($sFichierCrontab, $sLigne . "\n"); - } - fputs($sFichierCrontab, "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddCrontabValuesSubscription() { - $sSql = 'SELECT period_id, cron_expression, enabled FROM ' . $this->aProperties['schema_gtf'] . '.period'; - $oPDOresult = $this->oBd->executeWithParams($sSql, array()); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $sFichierCrontab = fopen($sCronFile, "a"); - fputs($sFichierCrontab, "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - while ($oPeriod = $this->oBd->objetSuivant($oPDOresult)) { - if ($oPeriod->enabled == true) { - $sActif = ""; - } else { - $sActif = "#"; - } - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $sLigne = $sActif . $oPeriod->cron_expression . " \"" . $this->EnginesHome . "/php/php.exe\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id; - } else { - $sLigne = $sActif . $oPeriod->cron_expression . " (\"" . $this->EnginesHome . "/php/bin/php\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id . ")"; - } - fputs($sFichierCrontab, $sLigne . "\n"); - } - fputs($sFichierCrontab, "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddPropertiesFME($sNotInList = "") { - $sFichierProperties = fopen($this->sGtfHome . "/rest/conf/gtf/properties_post_engines.inc", "w"); - fputs($sFichierProperties, "<?php" . "\n"); - $sLigne = '$properties["engines_list"] = \''; - $aParams = array(); - if ($sNotInList == "") { - $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE enabled = true ORDER BY gtf_engine_id'; - } else { - $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE gtf_engine_id not in (' . $sNotInList . ") AND enabled = true ORDER BY gtf_engine_id"; - $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); - } - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - while ($oFme = $this->oBd->objetSuivant($oPDOresult)) { - if ($sLigne == '$properties["engines_list"] = \'') { - $sLigne .= $oFme->gtf_engine_id; - } else { - $sLigne .= "," . $oFme->gtf_engine_id; - } - } - $sLigne .= "';"; - fputs($sFichierProperties, $sLigne . "\n"); - fputs($sFichierProperties, "?>" . "\n"); - } - -} - +<?php + +require_once __DIR__ . '/../../class/vmlib/dbUtil.inc'; +require_once __DIR__ . '/../../class/vmlib/logUtil.inc'; + +class ServerClass { + + //Chemin du fichier crontab + var $sCrontabFile; + //Id du server + var $iId; + //Nom du server + var $sServerName; + //Ancien nom du server + var $sOldServerName; + //Répertoire racine + var $sGtfHome; + //Répertoire Engines + var $EnginesHome; + //Objet de labase de données + var $oBd; + + function __construct($iId, $oBd, $sGtfHome, $sOldServerName = "", $aProperties = array()) { + $this->iId = $iId; + $this->oBd = $oBd; + $this->sOldServerName = $sOldServerName; + $this->sGtfHome = $sGtfHome; + $this->aProperties = $aProperties; + $this->setValues($iId); + } + + function setValues($iId) { + if ($iId != "") { + $sSql = 'SELECT scheduler_network_home, hostname, engines_home FROM ' . $this->aProperties['schema_gtf'] . '.server where server_id=[iIdServer]'; + $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + $oServer = $this->oBd->objetSuivant($oPDOresult); + $this->sCrontabFile = $oServer->scheduler_network_home; + $this->sServerName = $oServer->hostname; + $this->EnginesHome = $oServer->engines_home; + if ($this->sOldServerName == "") { + $this->sOldServerName = $this->sServerName; + } + } + } + + function deleteCrontabValuesEngine() { + $aValuesPycronNewFile = Array(); + if (is_file($this->sCrontabFile)) { + $aPycronValues = file($this->sCrontabFile); + $bWrite = true; + foreach ($aPycronValues as $sPycronValue) { + $sPycronValue = str_replace("\n", "", $sPycronValue); + $sPycronValue = str_replace("\r", "", $sPycronValue); + if ($sPycronValue == "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + + $bWrite = false; + } else if ($sPycronValue == "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + $bWrite = true; + } + if ($bWrite == true && $sPycronValue != "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + $aValuesPycronNewFile[] = $sPycronValue; + } + } + } + // On écrit dans le fichier texte + $sFichierCrontab = fopen($this->sCrontabFile, "w"); + // Le fichier texte est vidé + ftruncate($sFichierCrontab, 0); + $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); + $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); + foreach ($aValuesPycronNewFile as $sPycronValues2) { + fputs($sFichierCrontab, $sPycronValues2 . "\n"); + } + // Enfin fermer le fichier + fclose($sFichierCrontab); + } + + function deleteCrontabValuesSubscription() { + $aPycronValues = file($this->sCrontabFile); + $aValuesPycronNewFile = Array(); + $bWrite = true; + foreach ($aPycronValues as $sPycronValue) { + $sPycronValue = str_replace("\n", "", $sPycronValue); + $sPycronValue = str_replace("\r", "", $sPycronValue); + + if ($sPycronValue == "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + + $bWrite = false; + } else if ($sPycronValue == "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + $bWrite = true; + } + if ($bWrite == true && $sPycronValue != "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + $aValuesPycronNewFile[] = $sPycronValue; + } + } + // On écrit dans le fichier texte + $sFichierCrontab = fopen($this->sCrontabFile, "w"); + // Le fichier texte est vidé + ftruncate($sFichierCrontab, 0); + $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); + $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); + foreach ($aValuesPycronNewFile as $sPycronValues2) { + fputs($sFichierCrontab, $sPycronValues2 . "\n"); + } + // Enfin fermer le fichier + fclose($sFichierCrontab); + } + + function AddCrontabValuesEngines($sNotInList = "") { + if ($sNotInList == "") { + $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer]'; + } else { + $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer] AND gtf_engine_id not in ([sNotInList])'; + $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); + } + $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + $sFichierCrontab = fopen($this->sCrontabFile, "a"); + fputs($sFichierCrontab, "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + while ($oGTF = $this->oBd->objetSuivant($oPDOresult)) { + if ($oGTF->enabled == true) { + $sActif = ""; + } else { + $sActif = "#"; + } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $sLigne = $sActif . "*/" . $oGTF->period . " * * * * \"" . $this->EnginesHome . "/engine.exe\" " . $oGTF->gtf_engine_id; + } else { + $sLigne = $sActif . "*/" . $oGTF->period . " * * * * cd \"" . $this->EnginesHome . "\" && \"" . $this->EnginesHome . "/engine\" " . $oGTF->gtf_engine_id; + } + fputs($sFichierCrontab, $sLigne . "\n"); + } + fputs($sFichierCrontab, "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $sCronTmp = '/tmp/' . uniqid('cron_'); + exec("crontab -u www-data -l > " . $sCronTmp); + exec("crontab -u www-data " . $sCronTmp); + exec("rm " . $sCronTmp); + } + } + + function AddCrontabValuesSubscription() { + $sSql = 'SELECT period_id, cron_expression, enabled FROM ' . $this->aProperties['schema_gtf'] . '.period'; + $oPDOresult = $this->oBd->executeWithParams($sSql, array()); + $sFichierCrontab = fopen($this->sCrontabFile, "a"); + fputs($sFichierCrontab, "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + while ($oPeriod = $this->oBd->objetSuivant($oPDOresult)) { + if ($oPeriod->enabled == true) { + $sActif = ""; + } else { + $sActif = "#"; + } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $sLigne = $sActif . $oPeriod->cron_expression . " \"" . $this->EnginesHome . "/php/php.exe\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id; + } else { + $sLigne = $sActif . $oPeriod->cron_expression . " (\"" . $this->EnginesHome . "/php/bin/php\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id . ")"; + } + fputs($sFichierCrontab, $sLigne . "\n"); + } + fputs($sFichierCrontab, "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $sCronTmp = '/tmp/' . uniqid('cron_'); + exec("crontab -u www-data -l > " . $sCronTmp); + exec("crontab -u www-data " . $sCronTmp); + exec("rm " . $sCronTmp); + } + } + + function AddPropertiesFME($sNotInList = "") { + $sFichierProperties = fopen($this->sGtfHome . "/rest/conf/gtf/properties_post_engines.inc", "w"); + fputs($sFichierProperties, "<?php" . "\n"); + $sLigne = '$properties["engines_list"] = \''; + $aParams = array(); + if ($sNotInList == "") { + $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE enabled = true ORDER BY gtf_engine_id'; + } else { + $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE gtf_engine_id not in (' . $sNotInList . ") AND enabled = true ORDER BY gtf_engine_id"; + $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); + } + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + while ($oFme = $this->oBd->objetSuivant($oPDOresult)) { + if ($sLigne == '$properties["engines_list"] = \'') { + $sLigne .= $oFme->gtf_engine_id; + } else { + $sLigne .= "," . $oFme->gtf_engine_id; + } + } + $sLigne .= "';"; + fputs($sFichierProperties, $sLigne . "\n"); + fputs($sFichierProperties, "?>" . "\n"); + } + +} + ?> \ No newline at end of file diff --git a/src/module_gtf/web_service/ws/Servers.class.inc b/src/module_gtf/web_service/ws/Servers.class.inc index ba40d3c37b91bb8172f417c7e27c20381c32b099..ca05622a59d1668fae2f2d4f236c5b842bd76b05 100755 --- a/src/module_gtf/web_service/ws/Servers.class.inc +++ b/src/module_gtf/web_service/ws/Servers.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Server.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Servers extends GTF { /** diff --git a/src/module_gtf/web_service/ws/SmtpServer.class.inc b/src/module_gtf/web_service/ws/SmtpServer.class.inc index bf715b64b2210343b0f8da996be810deea64d2a2..441ab4c0ded62b441dd3b27bf7fb688586e3f0eb 100755 --- a/src/module_gtf/web_service/ws/SmtpServer.class.inc +++ b/src/module_gtf/web_service/ws/SmtpServer.class.inc @@ -14,8 +14,8 @@ // usage of this class is deprecated require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require_once 'PHPMailer/src/Exception.php'; diff --git a/src/module_gtf/web_service/ws/Statistics.class.inc b/src/module_gtf/web_service/ws/Statistics.class.inc index 5e2025b7137e45965df9dc533e7980b59edff4d9..c9d9702925deffdaf8207d85fb27e19fc7b0e9aa 100755 --- a/src/module_gtf/web_service/ws/Statistics.class.inc +++ b/src/module_gtf/web_service/ws/Statistics.class.inc @@ -12,8 +12,8 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; require 'Stats.class.inc'; class Statistics extends GTF { diff --git a/src/module_gtf/web_service/ws/Subscription.class.inc b/src/module_gtf/web_service/ws/Subscription.class.inc index c07bd07ea137b33320dd010e2b884e3b7bf78bcd..b13310675c68394fe3e9e512509b495150d0e435 100755 --- a/src/module_gtf/web_service/ws/Subscription.class.inc +++ b/src/module_gtf/web_service/ws/Subscription.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Subscription.class.inc @@ -28,7 +28,7 @@ class Subscription extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'priority_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', $this->getDateSelectedFields('order_date', 'yeartosecond'), 'log_url', $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'notification'); + $this->aSelectedFields = Array('order_id', 'priority_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', 'order_date', 'log_url', 'execution_date', 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'notification'); } /** diff --git a/src/module_gtf/web_service/ws/Subscriptions.class.inc b/src/module_gtf/web_service/ws/Subscriptions.class.inc index 74de1e181910b9d28cc1a2554eaf2866d1eca4de..b1dd3e1219c4a1337225f0e98391d1c1e3d5adb3 100755 --- a/src/module_gtf/web_service/ws/Subscriptions.class.inc +++ b/src/module_gtf/web_service/ws/Subscriptions.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Subscription.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Subscriptions extends GTF { /** @@ -34,13 +34,13 @@ class Subscriptions extends GTF { * construct * @param type $aPath url of the request * @param type $aValues parameters of the request - * @param type $properties properties - * @param type $bShortcut false to reinit variables + * @param type $properties properties + * @param type $bShortcut false to reinit variables * @param type $oConnection connection object */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'priority_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', $this->getDateSelectedFields('order_date', 'yeartosecond'), 'log_url', $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'notification'); + $this->aSelectedFields = Array('order_id', 'priority_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', 'order_date', 'log_url', 'execution_date', 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'notification'); } /** diff --git a/src/module_gtf/web_service/ws/SupervisionStatus.class.inc b/src/module_gtf/web_service/ws/SupervisionStatus.class.inc index 396a82695194a999f5727ffd4cedd5e3c07f32d2..1991f1e9053ee572ff9c419e8f17435143331f07 100755 --- a/src/module_gtf/web_service/ws/SupervisionStatus.class.inc +++ b/src/module_gtf/web_service/ws/SupervisionStatus.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file SupervisionStatus.class.inc diff --git a/src/module_gtf/web_service/ws/SupervisionStatutes.class.inc b/src/module_gtf/web_service/ws/SupervisionStatutes.class.inc index ad0ee6f9992201369ef8b1e4cdfa4659567431d7..20f2862445db110aa532c8aac0fc09c03927bae6 100755 --- a/src/module_gtf/web_service/ws/SupervisionStatutes.class.inc +++ b/src/module_gtf/web_service/ws/SupervisionStatutes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'SupervisionStatus.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class SupervisionStatutes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Survey.class.inc b/src/module_gtf/web_service/ws/Survey.class.inc index 7d4a7f4ae3091cab00c29ed0ec86099629447f22..ca6356aadd0404c1ab9536abcc1019ab6659275a 100755 --- a/src/module_gtf/web_service/ws/Survey.class.inc +++ b/src/module_gtf/web_service/ws/Survey.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Survey.class.inc @@ -28,7 +28,7 @@ class Survey extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'workspace_key', 'priority_id', 'workspace_id', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', $this->getDateSelectedFields('order_date', 'yeartosecond'), 'log_url', $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'survey_id', 'condition', 'warehouse_name', 'notification', 'survey_name'); + $this->aSelectedFields = Array('order_id', 'workspace_key', 'priority_id', 'workspace_id', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', 'order_date', 'log_url', 'execution_date', 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'survey_id', 'condition', 'warehouse_name', 'notification', 'survey_name'); } /** diff --git a/src/module_gtf/web_service/ws/SurveyType.class.inc b/src/module_gtf/web_service/ws/SurveyType.class.inc index a12d7107d71ac2889a2faf41ecbb6bad52a1e29f..458dddde508cddb759cbbbe63c4dc9345c402eca 100755 --- a/src/module_gtf/web_service/ws/SurveyType.class.inc +++ b/src/module_gtf/web_service/ws/SurveyType.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file SurveyType.class.inc diff --git a/src/module_gtf/web_service/ws/SurveyTypes.class.inc b/src/module_gtf/web_service/ws/SurveyTypes.class.inc index d72bd10480a882124b1c9979b1327554dc307de3..24bd840aba3ef9da6036b0ee2c2bb10cd08aa94d 100755 --- a/src/module_gtf/web_service/ws/SurveyTypes.class.inc +++ b/src/module_gtf/web_service/ws/SurveyTypes.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'SurveyType.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class SurveyTypes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Surveys.class.inc b/src/module_gtf/web_service/ws/Surveys.class.inc index 52657a5f0f7d0dc9f58ed4c6ab10f4b22cafdc11..48c01bea9d2fea1df324dc0ff8f3e4d9eccadcdd 100755 --- a/src/module_gtf/web_service/ws/Surveys.class.inc +++ b/src/module_gtf/web_service/ws/Surveys.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Survey.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Surveys extends GTF { /** @@ -34,13 +34,13 @@ class Surveys extends GTF { * construct * @param type $aPath url of the request * @param type $aValues parameters of the request - * @param type $properties properties - * @param type $bShortcut false to reinit variables + * @param type $properties properties + * @param type $bShortcut false to reinit variables * @param type $oConnection connection object */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'workspace_key', 'priority_id', 'workspace_id', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', $this->getDateSelectedFields('order_date', 'yeartosecond'), 'log_url', $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'survey_id', 'condition', 'warehouse_name', 'notification', 'survey_name', "name || '/' || condition as full_condition"); + $this->aSelectedFields = Array('order_id', 'workspace_key', 'priority_id', 'workspace_id', 'enabled', 'label_name', 'order_status_id', 'user_id', 'login', 'period_id', 'order_period_libelle', 'wk_params', 'result_url', 'order_date', 'log_url', 'execution_date', 'attempt', 'email_notifications', 'email_option_id', 'deleted', 'gtf_engine_id', 'survey_id', 'condition', 'warehouse_name', 'notification', 'survey_name', "name || '/' || condition as full_condition"); } /** diff --git a/src/module_gtf/web_service/ws/Tag.class.inc b/src/module_gtf/web_service/ws/Tag.class.inc index 5278084891136b208a99241dd83877b54edf9799..6fd0e51077cf965bdcafe197195a3b1b8410f097 100755 --- a/src/module_gtf/web_service/ws/Tag.class.inc +++ b/src/module_gtf/web_service/ws/Tag.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Tag.class.inc diff --git a/src/module_gtf/web_service/ws/Tags.class.inc b/src/module_gtf/web_service/ws/Tags.class.inc index d4309a0a8b9cc2ba0cebba647508af6b513fc285..0cf4c3568e3d608b1dca4a4ca3952e633ac8a335 100755 --- a/src/module_gtf/web_service/ws/Tags.class.inc +++ b/src/module_gtf/web_service/ws/Tags.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Tag.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class Tags extends GTF { /** diff --git a/src/module_gtf/web_service/ws/UserInboxe.class.inc b/src/module_gtf/web_service/ws/UserInboxe.class.inc index 5f426e42551b107cbf86925bb0860dad2ae7939e..22624b7d48caae4e2cac4af6555a9003a0c7794a 100755 --- a/src/module_gtf/web_service/ws/UserInboxe.class.inc +++ b/src/module_gtf/web_service/ws/UserInboxe.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Inbox.class.inc diff --git a/src/module_gtf/web_service/ws/UserInboxes.class.inc b/src/module_gtf/web_service/ws/UserInboxes.class.inc index 93cbab60f7c83f0eb9b3c01984ee196752a8d7a9..7c21aa99a14b1d03f708a6959c30ea059d010862 100755 --- a/src/module_gtf/web_service/ws/UserInboxes.class.inc +++ b/src/module_gtf/web_service/ws/UserInboxes.class.inc @@ -13,9 +13,9 @@ */ require_once 'Gtf.class.inc'; require_once 'UserInboxe.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/phpUtil.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/phpUtil.inc'; class UserInboxes extends GTF { /** diff --git a/src/module_gtf/web_service/ws/UserOrder.class.inc b/src/module_gtf/web_service/ws/UserOrder.class.inc index 8b80abfff0cb81b2fa0c4ef3c591d91f8c845fb3..23299a5f42e88bbeceb9267ab39cca1a87d4754f 100755 --- a/src/module_gtf/web_service/ws/UserOrder.class.inc +++ b/src/module_gtf/web_service/ws/UserOrder.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file UserOrder.class.inc @@ -28,7 +28,7 @@ class UserOrder extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("order_id", "priority_id", "workspace_key", "workspace_id", "name", "order_status_id", "user_id", "wk_params", "result_url", $this->getDateSelectedFields('order_date', 'yeartosecond'), "log_url", $this->getDateSelectedFields('execution_date', 'yeartosecond'), "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "workspace_name", $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array("order_id", "priority_id", "workspace_key", "workspace_id", "name", "order_status_id", "user_id", "wk_params", "result_url", "order_date", "log_url", "execution_date", "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "workspace_name", "priority_label"); } /** diff --git a/src/module_gtf/web_service/ws/UserOrders.class.inc b/src/module_gtf/web_service/ws/UserOrders.class.inc index b0919bb3ecfaf61b8412fe4a3594420d092dcbb5..584b9bba2d38514c8709b626b749ea95e44cfca4 100755 --- a/src/module_gtf/web_service/ws/UserOrders.class.inc +++ b/src/module_gtf/web_service/ws/UserOrders.class.inc @@ -12,10 +12,10 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'UserOrder.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/ws/vitis/PrivateToken.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../vitis/PrivateToken.class.inc'; class UserOrders extends GTF { /** @@ -41,7 +41,7 @@ class UserOrders extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("order_id", "priority_id", "workspace_key", "workspace_id", "name", "order_status_id", "user_id", "wk_params", "result_url", $this->getDateSelectedFields('order_date', 'yeartosecond'), "log_url", $this->getDateSelectedFields('execution_date', 'yeartosecond'), "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "workspace_name", "email_option_label", "order_status_label", $this->getDateSelectedFields('minexecdate', 'yeartosecond')); + $this->aSelectedFields = Array("order_id", "priority_id", "workspace_key", "workspace_id", "name", "order_status_id", "user_id", "wk_params", "result_url", "to_char(order_date, 'YYYY-MM-DD HH24:MI:SS') as order_date", "log_url", "to_char(execution_date, 'YYYY-MM-DD HH24:MI:SS') as execution_date", "attempt", "email_notifications", "email_option_id", "deleted", "gtf_engine_id", "length_sec", "workspace_name", "priority_label", "email_option_label", "order_status_label"); } /** @@ -185,12 +185,7 @@ class UserOrders extends GTF { * @return id of the user's userorder created */ function POST() { - $this->aValues['order_date'] = gmdate('Y-m-d H:i:s'); - $this->aValues['priority_id'] = 1; - if (!empty($this->aValues['minexecdate'])) - $this->aValues['minexecdate'] = gmdate('Y-m-d H:i:00', date_timestamp_get(date_create_from_format('d/m/Y H:i', $this->aValues['minexecdate']))); - else - $this->aValues['minexecdate'] = null; + $this->aValues['order_date'] = date('Y-m-d H:i:s'); if (!empty($_SESSION['ses_user_id'])) $this->aValues['user_id'] = $_SESSION['ses_user_id']; if (!empty($this->aValues['email_notifications'])) diff --git a/src/module_gtf/web_service/ws/UserSubscription.class.inc b/src/module_gtf/web_service/ws/UserSubscription.class.inc index 6e0b5b45823df8c869a739839bbaab1afbc9c171..9897c96141a67c4419a6ef60e94276ff374ec605 100755 --- a/src/module_gtf/web_service/ws/UserSubscription.class.inc +++ b/src/module_gtf/web_service/ws/UserSubscription.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file UserSubscription.class.inc @@ -28,7 +28,7 @@ class UserSubscription extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'period_id', $this->getDateSelectedFields('order_date', 'yeartosecond'), $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'workspace_name', 'notification', 'order_period_libelle'); + $this->aSelectedFields = Array('order_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'period_id', 'order_date', 'execution_date', 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'workspace_name', 'notification', 'order_period_libelle'); } /** diff --git a/src/module_gtf/web_service/ws/UserSubscriptions.class.inc b/src/module_gtf/web_service/ws/UserSubscriptions.class.inc index e70b529f49dc172522680880274ec5b1ad4105ba..bb44deea03c02c6d607f5e194196ceee95bd5b5d 100755 --- a/src/module_gtf/web_service/ws/UserSubscriptions.class.inc +++ b/src/module_gtf/web_service/ws/UserSubscriptions.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'UserSubscription.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class UserSubscriptions extends GTF { /** @@ -40,7 +40,7 @@ class UserSubscriptions extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'period_id', $this->getDateSelectedFields('order_date', 'yeartosecond'), $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'workspace_name', 'notification', 'order_period_libelle'); + $this->aSelectedFields = Array('order_id', 'workspace_id', 'workspace_key', 'enabled', 'label_name', 'order_status_id', 'user_id', 'period_id', 'order_date', 'execution_date', 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'workspace_name', 'notification', 'order_period_libelle'); } /** @@ -214,7 +214,7 @@ class UserSubscriptions extends GTF { * @return id of the user's usersubscription created */ function POST() { - $this->aValues['order_date'] = gmdate('Y-m-d H:i:s'); + $this->aValues['order_date'] = date('Y-m-d H:i:s'); $this->aValues['user_id'] = $_SESSION['ses_user_id']; // Si token public -> id du compte public. if ($this->aValues['token'] == $this->aProperties['public_token']) { diff --git a/src/module_gtf/web_service/ws/UserSurvey.class.inc b/src/module_gtf/web_service/ws/UserSurvey.class.inc index a603ae25cb6196baabd96e161012146d67500024..8abb3057c79d93adc3c7e1990be16aa2a10a701e 100755 --- a/src/module_gtf/web_service/ws/UserSurvey.class.inc +++ b/src/module_gtf/web_service/ws/UserSurvey.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file UserSurvey.class.inc @@ -28,7 +28,7 @@ class UserSurvey extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('order_id', 'workspace_key', 'workspace_id', 'label_name', 'enabled', 'order_status_id', 'user_id', 'period_id', $this->getDateSelectedFields('order_date', 'yeartosecond'), $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'survey_id', 'condition', 'inbox_id', 'name', 'workspace_name', 'monitoring_type', 'notification', 'order_period_libelle', 'survey_name'); + $this->aSelectedFields = Array('order_id', 'workspace_key', 'workspace_id', 'label_name', 'enabled', 'order_status_id', 'user_id', 'period_id', 'order_date', 'execution_date', 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'survey_id', 'condition', 'inbox_id', 'name', 'workspace_name', 'monitoring_type', 'notification', 'order_period_libelle', 'survey_name'); } /** diff --git a/src/module_gtf/web_service/ws/UserSurveys.class.inc b/src/module_gtf/web_service/ws/UserSurveys.class.inc index e9e955c9d5d1475f338315347ca7b10a9bcb2c8c..f17e377d6b2e8039a623ee00325164861ceb395e 100755 --- a/src/module_gtf/web_service/ws/UserSurveys.class.inc +++ b/src/module_gtf/web_service/ws/UserSurveys.class.inc @@ -12,9 +12,9 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'UserSurvey.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; class UserSurveys extends GTF { /** @@ -41,7 +41,7 @@ class UserSurveys extends GTF { function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); $login = $_SESSION['ses_Login']; - $this->aSelectedFields = Array('order_id', 'workspace_key', 'workspace_id', 'label_name', 'enabled', 'order_status_id', 'user_id', 'period_id', $this->getDateSelectedFields('order_date', 'yeartosecond'), $this->getDateSelectedFields('execution_date', 'yeartosecond'), 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'survey_id', 'condition', 'inbox_id', 'name', 'workspace_name', 'monitoring_type', 'notification', 'order_period_libelle', 'survey_name', "replace(name, '\$user', '$login') || '/' || condition as full_condition"); + $this->aSelectedFields = Array('order_id', 'workspace_key', 'workspace_id', 'label_name', 'enabled', 'order_status_id', 'user_id', 'period_id', 'order_date', 'execution_date', 'wk_params', 'result_url', 'email_option_id', 'email_notifications', 'gtf_engine_id', 'survey_id', 'condition', 'inbox_id', 'name', 'workspace_name', 'monitoring_type', 'notification', 'order_period_libelle', 'survey_name', "replace(name, '\$user', '$login') || '/' || condition as full_condition"); } /** @@ -238,7 +238,7 @@ class UserSurveys extends GTF { * @return id of the user's usersurvey created */ function POST() { - $this->aValues['order_date'] = gmdate('Y-m-d H:i:s'); + $this->aValues['order_date'] = date('Y-m-d H:i:s'); $this->aValues['user_id'] = $_SESSION['ses_user_id']; // Si token public -> id du compte public. if ($this->aValues['token'] == $this->aProperties['public_token']) { diff --git a/src/module_gtf/web_service/ws/UserWorkspace.class.inc b/src/module_gtf/web_service/ws/UserWorkspace.class.inc index ab5e357b5f6c8fd8818928943435b84fee1e9973..21e0414cf0db34d4d0a221da94f093cf22912573 100755 --- a/src/module_gtf/web_service/ws/UserWorkspace.class.inc +++ b/src/module_gtf/web_service/ws/UserWorkspace.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'vmlib/logUtil.inc'; /** diff --git a/src/module_gtf/web_service/ws/UserWorkspaces.class.inc b/src/module_gtf/web_service/ws/UserWorkspaces.class.inc index 5fd494de1b691f46e6f066c4490e21ca0a6454b6..464b8794734ed98ea6757c7a76945f00dea059a4 100755 --- a/src/module_gtf/web_service/ws/UserWorkspaces.class.inc +++ b/src/module_gtf/web_service/ws/UserWorkspaces.class.inc @@ -13,9 +13,9 @@ */ require_once 'Gtf.class.inc'; require_once 'UserWorkspace.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/phpUtil.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/phpUtil.inc'; class UserWorkspaces extends GTF { /** diff --git a/src/module_gtf/web_service/ws/Workspace.class.inc b/src/module_gtf/web_service/ws/Workspace.class.inc index 07a23d46851c83cd464c1eb8445c26eae394af73..c0da2c82c4d22337f068c79f1ee421b50495c2d1 100755 --- a/src/module_gtf/web_service/ws/Workspace.class.inc +++ b/src/module_gtf/web_service/ws/Workspace.class.inc @@ -1,7 +1,7 @@ <?php require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; /** * \file Workspace.class.inc @@ -28,7 +28,7 @@ class Workspace extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('workspace_id', 'name', 'owner', $this->getDateSelectedFields('creation_date', 'yeartosecond'), 'description', 'subscription', 'category_id', 'success_action_id', 'failed_action_id', 'survey', 'form_type', 'legal_terms_conditions', $this->getDateSelectedFields('last_save_date', 'yeartosecond'), 'last_save_build', 'file_encoding', 'title', 'requirements', 'history', 'usage', 'key', 'email_template_id', 'locked', 'tag', 'groups', 'login', 'category_name', 'email_template', 'fmw_file', 'dataencrypt', 'usepersonaldata', 'unitcost', 'costpersecond'); + $this->aSelectedFields = Array('workspace_id', 'name', 'owner', 'creation_date', 'description', 'subscription', 'category_id', 'success_action_id', 'failed_action_id', 'survey', 'form_type', 'legal_terms_conditions', 'last_save_date', 'last_save_build', 'file_encoding', 'title', 'requirements', 'history', 'usage', 'key', 'email_template_id', 'locked', 'tag', 'groups', 'login', 'category_name', 'email_template', 'fmw_file'); } /** diff --git a/src/module_gtf/web_service/ws/Workspaces.class.inc b/src/module_gtf/web_service/ws/Workspaces.class.inc index 521713a108af401fa00b0e09fad16465a2433361..7d3acdd097d5e2bbb030e9ef8c7303bb78dbcf10 100755 --- a/src/module_gtf/web_service/ws/Workspaces.class.inc +++ b/src/module_gtf/web_service/ws/Workspaces.class.inc @@ -12,11 +12,11 @@ * */ require_once 'Gtf.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; require_once 'Workspace.class.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/phpUtil.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/gtf_lib/GtfFmwParser.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; +require_once __DIR__ . '/../../class/vmlib/phpUtil.inc'; +require_once __DIR__ . '/../../class/gtf_lib/GtfFmwParser.class.inc'; class Workspaces extends GTF { /** @@ -42,7 +42,7 @@ class Workspaces extends GTF { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array('workspace_id', 'name', 'fmw_file', 'owner', $this->getDateSelectedFields('creation_date', 'yeartosecond'), 'description', 'subscription', 'category_id', 'success_action_id', 'failed_action_id', 'survey', 'form_type', 'legal_terms_conditions', $this->getDateSelectedFields('last_save_date', 'yeartosecond'), 'last_save_build', 'file_encoding', 'title', 'requirements', 'history', 'usage', 'key', 'email_template_id', 'locked', 'tag', 'login', 'category_name', 'nb_demande', 'email_template', 'dataencrypt', 'usepersonaldata'); + $this->aSelectedFields = Array('workspace_id', 'name', 'fmw_file', 'owner', 'creation_date', 'description', 'subscription', 'category_id', 'success_action_id', 'failed_action_id', 'survey', 'form_type', 'legal_terms_conditions', 'last_save_date', 'last_save_build', 'file_encoding', 'title', 'requirements', 'history', 'usage', 'key', 'email_template_id', 'locked', 'tag', 'login', 'category_name', 'nb_demande', 'email_template'); } /** @@ -345,7 +345,7 @@ class Workspaces extends GTF { $aParams['sFileName'] = array('value' => str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'][$i])), 'type' => 'string'); $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getWorkspaceId'], $aParams); if ($aWorkspace = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { - $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'][$i])) . gmdate("Ymd-His") . rand(0, 100); + $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'][$i])) . date("Ymd-His") . rand(0, 100); } else { $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'][$i])); } @@ -357,7 +357,7 @@ class Workspaces extends GTF { $this->aValues['tag'] = 'default'; $this->aValues['survey'] = 'FALSE'; $this->aValues['form_type'] = 'default'; - $this->aValues['creation_date'] = gmdate("Y-m-d H:i:s"); + $this->aValues['creation_date'] = date("Y-m-d"); // Id de l'utilisateur connecté. $aParams = array(); $aParams['sSchemaFramework'] = array('value' => $this->aProperties["schema_framework"], 'type' => 'schema_name'); @@ -439,7 +439,7 @@ class Workspaces extends GTF { $aParams['sFileName'] = array('value' => str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'])), 'type' => 'string'); $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getWorkspaceId'], $aParams); if ($aWorkspace = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { - $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'])) . gmdate("Ymd-His") . rand(0, 100); + $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'])) . date("Ymd-His") . rand(0, 100); } else { $this->aValues['name'] = str_replace(".fmw", "", str_replace(".fme", "", $_FILES['fmw_file']['name'])); } @@ -456,7 +456,7 @@ class Workspaces extends GTF { $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } else { - $this->aValues['creation_date'] = gmdate('Y-m-d H:i:s'); + $this->aValues['creation_date'] = date('Y-m-d'); // Création de la clé du projet. $bExistKey = false; while ($bExistKey == false) { @@ -483,7 +483,7 @@ class Workspaces extends GTF { $this->aValues["comp_file"] = $_FILES["comp_file"]["name"]; //si pas de zip la chaine est vide $aExt = explode(".", $this->aValues["fmw_file"]); if ($aExt[count($aExt) - 1] == "fmw") { - $this->aValues['creation_date'] = gmdate('Y-m-d H:i:s'); + $this->aValues['creation_date'] = date('Y-m-d'); $this->aValues['owner'] = $_SESSION["ses_user_id"]; $this->aValues['form_type'] = 'custom'; if ($this->aValues["name"] == "") { @@ -495,7 +495,7 @@ class Workspaces extends GTF { $sFilename = $sFilename . $aExt[$i]; } if (!$this->oConnection->oBd->enErreur() && $this->oConnection->oBd->nombreLigne($oPDOresult) > 0) { - $this->aValues['name'] = $sFilename . gmdate("Ymd-His") . rand(0, 100); + $this->aValues['name'] = $sFilename . date("Ymd-His") . rand(0, 100); } else { $this->aValues['name'] = $sFilename; } @@ -892,7 +892,7 @@ class Workspaces extends GTF { // Récupère les anciens paramètres. $oFmwParser->getBdMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); // Mise à jour des paramètres du nouveau fichier dans la base. - $oFmwParser->sSaveDate = gmdate('Y-m-d G:i:s'); + $oFmwParser->sSaveDate = date('Y-m-d G:i:s'); $oFmwParser->updateMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); } } else { @@ -1047,7 +1047,7 @@ class Workspaces extends GTF { if ($aReturn['status'] == 1) { $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } else { - $oError = new VitisError(1, 'LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE'); + $oError = new VitisError($aReturn['error_code'], $aReturn['message']); $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } } elseif ($this->aPath[3] == "DeleteWidgetFile") { @@ -1218,7 +1218,7 @@ class Workspaces extends GTF { $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getWorkspaceLastSaveData'], $aParams); if (!$this->oConnection->oBd->enErreur()) { $aRow = $this->oConnection->oBd->ligneSuivante($oPDOresult); - $oObject->sSaveDate = gmdate('Y-m-d G:i:s'); + $oObject->sSaveDate = date('Y-m-d G:i:s'); $oObject->sSaveBuild = $aRow['last_save_build']; } // Mise à jour du projet en base.