From 4b9efc9c46f7c56c17380236fee1079cc90d831c Mon Sep 17 00:00:00 2001 From: tofulm Date: Mon, 27 Apr 2020 14:05:19 +0200 Subject: [PATCH] On supprime les pdfs temporaires --- formulaires/gamumail.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/formulaires/gamumail.php b/formulaires/gamumail.php index 0362af3..f8f05d7 100644 --- a/formulaires/gamumail.php +++ b/formulaires/gamumail.php @@ -131,6 +131,7 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T } // les pdfs + $Tpdf_dell = []; if (!empty($Tpdfs_ok) and is_array($Tpdfs_ok)) { if (array_key_exists('fichier', $Tpdf)) { $Tpdf = [$Tpdf]; @@ -148,6 +149,7 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T $pdf = $recup_pdf($pdf, $c); $nom_fichier = $nom.'.pdf'; $destination = _DIR_TMP.basename($nom_fichier); + $Tpdf_dell[] = $destination; file_put_contents($destination,$pdf); $pieces_jointes[] = [ 'chemin' => $destination, @@ -180,6 +182,13 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T $retour['message_ok'] = _T('gamumail:mail_envoye'); } + // on supprime les pdfs temporaires + if (count($Tpdf_dell)) { + foreach ($Tpdf_dell as $pdf) { + unlink($pdf); + } + } + if ($redirect) { $retour['redirect'] = $redirect; }