noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 02/04: For saving space , the temp PDF are un


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 02/04: For saving space , the temp PDF are unlinked after sending
Date: Wed, 15 Feb 2017 16:13:24 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 1f005648c0dbb33441437b7c33e4118c3e53a69d
Author: Dany De Bontridder <address@hidden>
Date:   Wed Feb 8 20:46:06 2017 +0100

    For saving space , the temp PDF are unlinked after sending
---
 include/class/class_document_export.php | 15 ++++++++++++---
 include/class/class_pdf_operation.php   |  7 +++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/include/class/class_document_export.php 
b/include/class/class_document_export.php
index 05a95fa..fc20d52 100644
--- a/include/class/class_document_export.php
+++ b/include/class/class_document_export.php
@@ -98,13 +98,19 @@ class Document_Export
      */
     function clean_folder()
     {
-        return;
         $files=  scandir($this->store_convert);
-        $nb_file=count($file);
+        $nb_file=count($files);
         for ($i=0;$i < $nb_file;$i++) {
-            if (is_file($files[$i])) unlink($file[$i]);
+            if (is_file($this->store_convert."/".$files[$i])) 
unlink($this->store_convert."/".$files[$i]);
         }
         rmdir($this->store_convert);
+        $files=  scandir($this->store_pdf);
+        $nb_file=count($files);
+        for ($i=0;$i < $nb_file;$i++) {
+            if (is_file($this->store_pdf."/".$files[$i])) 
unlink($this->store_pdf."/".$files[$i]);
+        }
+        rmdir($this->store_pdf);
+        
     }
 
     /**
@@ -243,6 +249,9 @@ class Document_Export
                 $cnt_feedback++;
                 continue;
             }
+            // remove doc with detail
+            $detail_operation->unlink();
+            
             // overwrite old with new PDF
             rename ($output2,$output);
             
diff --git a/include/class/class_pdf_operation.php 
b/include/class/class_pdf_operation.php
index 7a57427..d0975c1 100644
--- a/include/class/class_pdf_operation.php
+++ b/include/class/class_pdf_operation.php
@@ -459,4 +459,11 @@ class PDF_Operation extends PDF {
     function download_pdf() {
         
$this->pdf->Output("acc_op".$this->acc_detail->det->jr_internal.".pdf");
     }
+    /**
+     * @brief unlink the file if exists
+     */
+    function unlink() {
+        $file=$this->get_pdf_filename();
+        if ( is_file($file)) unlink ($file);
+    }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]