From a9e244ffdfbf9761dd45c59607b51682be1e9410 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Carretero?=
 <frederic.carretero@veremes.com>
Date: Mon, 19 Nov 2018 11:30:03 +0100
Subject: [PATCH] =?UTF-8?q?Suppression=20du=20r=C3=A9pertoire=20du=20proje?=
 =?UTF-8?q?t=20FME?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 web_service/ws/Workspace.class.inc  | 10 ++--------
 web_service/ws/Workspaces.class.inc |  3 +--
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/web_service/ws/Workspace.class.inc b/web_service/ws/Workspace.class.inc
index 07a23d46..267f7b48 100755
--- a/web_service/ws/Workspace.class.inc
+++ b/web_service/ws/Workspace.class.inc
@@ -273,14 +273,8 @@ class Workspace extends GTF {
         if ($this->oConnection->oBd->enErreur()) {
             $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage());
         } else {
-            $this->aFields['workspace_id'] = $this->aValues["my_vitis_id"];
-
-            $sDirName = $this->aProperties['workspace_dir'] . "/" . $this->aFields["workspace_id"] . "/";
-            if (is_dir($sDirName)) {
-                clearDir($sDirName);
-            } else {
-                writeToErrorLog("No folder link with this workspace. verify if the workspace folder already exist on the server");
-            }
+            // Suppression du répertoire du projet FME.
+            deleteDirectoryInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], '', '');
         }
     }
 
diff --git a/web_service/ws/Workspaces.class.inc b/web_service/ws/Workspaces.class.inc
index 6f6592a6..1c01ecbb 100755
--- a/web_service/ws/Workspaces.class.inc
+++ b/web_service/ws/Workspaces.class.inc
@@ -502,8 +502,7 @@ class Workspaces extends GTF {
                                 }
                                 $sDirName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"];
                                 // Si le répertoire existe déja : suppression.
-                                if (is_dir($sDirName))
-                                    clearDir($sDirName);
+                                deleteDirectoryInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], '', '');
                                 // Upload du fichier fmw.
                                 $this->aValues['fme'] = $this->aValues['fmw_file'];
                                 $_FILES['fme'] = $_FILES['fmw_file'];
-- 
GitLab