Add destructor wich will try to clean up temp file of the template

processor
This commit is contained in:
Maarten de Keizer 2022-01-04 10:22:38 +01:00
parent aca10785cf
commit e9cd17d4c7
1 changed files with 8 additions and 0 deletions

View File

@ -132,6 +132,14 @@ class TemplateProcessor
$this->tempDocumentContentTypes = $this->zipClass->getFromName($this->getDocumentContentTypesName()); $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 * Expose zip class
* *