Merge pull request #2176 from maartendekeizer/cleanuptempfile

[TemplateProcessor] Clean up temp files
This commit is contained in:
Adrien Crivelli 2022-09-17 23:21:07 +02:00 committed by GitHub
commit 62444d2161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -131,6 +131,14 @@ class TemplateProcessor
$this->tempDocumentContentTypes = $this->zipClass->getFromName($this->getDocumentContentTypesName());
}
public function __destruct()
{
// if the temp file still exists, remove it when running destruct
if ($this->tempDocumentFilename && file_exists($this->tempDocumentFilename) && is_writable($this->tempDocumentFilename)) {
@unlink($this->tempDocumentFilename);
}
}
/**
* Expose zip class.
*