From 77541a21bd182c531c551921b51fc078cc8a0008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Carretero?= <frederic.carretero@veremes.com> Date: Mon, 26 Nov 2018 12:28:46 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9compression=20du=20fichier=20.zip=20de?= =?UTF-8?q?=20ressources=20d'un=20projet=20FME=20sur=20S3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_service/ws/Workspaces.class.inc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/web_service/ws/Workspaces.class.inc b/web_service/ws/Workspaces.class.inc index 7db2edfa..0e9a34d2 100755 --- a/web_service/ws/Workspaces.class.inc +++ b/web_service/ws/Workspaces.class.inc @@ -525,15 +525,12 @@ class Workspaces extends GTF { putFileContentInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'form/ressources', 'Subform.css', ''); // Upload du fichier de ressource. if ($this->aValues["comp_file"] != "") { + // Si le fichier est une archive .zip -> décompression et copie des fichiers. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $_FILES['comp_file']['tmp_name']); $this->aValues['fme'] = $this->aValues['comp_file']; $_FILES['fme'] = $_FILES['comp_file']; $sErrorMessage = uploadInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], "fme", $this->aValues); - /* - $ext = pathinfo($_FILES['comp_file']['name'], PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($_FILES['comp_file']['name']), $sDirName . "/fme/"); - } - */ } // Lit le contenu du fichier .fmw du projet. $sFmwFileContent = getFileContentInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], 'fme', $_FILES['fmw_file']['name']); @@ -828,12 +825,12 @@ class Workspaces extends GTF { if (!empty($this->aValues["comp_file_file"])) { $this->aValues["comp_file"] = $this->aValues["comp_file_name"]; putFileContentInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $this->aValues["comp_file_name"], $this->aValues["comp_file_file"]); - /* - $ext = pathinfo($_FILES['comp_file']['name'], PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($_FILES['comp_file']['name']), $sDirName . "/fme/"); + // Si le fichier est une archive .zip -> décompression et copie du répertoire. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") { + $sZipFilePath = $this->aProperties['extract_dir'] . '/' . $this->aValues["comp_file_name"]; + file_put_contents($sZipFilePath, $this->aValues["comp_file_file"]); + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $sZipFilePath); } - */ } $aReturn = $this->genericPut($this->aProperties['schema_gtf'], 'workspace', 'workspace_id'); if ($aReturn["sStatus"] == 1) { -- GitLab