[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);
+ }
}
- [Noalyss-commit] [noalyss] branch master updated (b781c15 -> d3e2cd4), Dany De Bontridder, 2017/02/15
- [Noalyss-commit] [noalyss] 02/04: For saving space , the temp PDF are unlinked after sending,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 01/04: warning for exporting ANC_RECEIPT , it lasts a few minutes , depending of the number of documents to export, Dany De Bontridder, 2017/02/15
- [Noalyss-commit] [noalyss] 04/04: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/15
- [Noalyss-commit] [noalyss] 03/04: Security : fix potential problem for SQL injection, Dany De Bontridder, 2017/02/15