From d85d6f8c77083fb997441a672d222bb10836af3e Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 1 Dec 2018 17:57:15 +0100 Subject: [PATCH] replace tempname with sys_get_temp_dir --- include/class/document_export.class.php | 9 +++++---- include/constant.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/class/document_export.class.php b/include/class/document_export.class.php index fea8edc71..f491ab11a 100644 --- a/include/class/document_export.class.php +++ b/include/class/document_export.class.php @@ -38,13 +38,13 @@ class Document_Export // Create 2 temporary folders 1. convert to PDF + stamp // 2. store result $this->feedback = array(); - $this->store_convert = tempnam($_ENV['TMP'], 'convert_'); - $this->store_pdf = tempnam($_ENV['TMP'], 'pdf_'); + $this->store_convert = tempnam(sys_get_temp_dir(), 'convert_'); + $this->store_pdf = tempnam(sys_get_temp_dir(), 'pdf_'); unlink($this->store_convert); unlink($this->store_pdf); umask(0); - mkdir($this->store_convert); - mkdir($this->store_pdf); + if ( mkdir($this->store_convert) == FALSE ) throw new Exception(sprintf("Create %s failed",$this->store_onvert)); + if ( mkdir($this->store_pdf)== FALSE ) throw new Exception(sprintf("Create %s failed",$this->store_pdf)); } /** * @brief concatenate all PDF into a single one and save it into the @@ -177,6 +177,7 @@ class Document_Export $cnt_feedback++; continue; } + $progress->increment($step); // diff --git a/include/constant.php b/include/constant.php index 34489ca5d..0e361d09a 100644 --- a/include/constant.php +++ b/include/constant.php @@ -271,7 +271,7 @@ if ( ! file_exists($ps2pdf) ) /** * Outil pour manipuler les PDF */ -$pdftk='/usr/bin/pdftk'; +$pdftk='/snap/bin/pdftk'; if (file_exists($pdftk)) { define ('PDFTK',$pdftk);