Also change glob to readdir which performs better

This commit is contained in:
Adrien Foulon 2019-03-22 13:13:31 +01:00 committed by GitHub
parent e91887e463
commit de0ae1af61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7756,9 +7756,13 @@ class TCPDF {
if ($destroyall AND !$preserve_objcopy) {
self::$cleaned_ids[$this->file_id] = true;
// remove all temporary files
$tmpfiles = glob(K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_*');
if (!empty($tmpfiles)) {
array_map('unlink', $tmpfiles);
if ($handle = opendir(K_PATH_CACHE)) {
while ( false !== ( $file_name = readdir( $handle ) ) ) {
if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) {
unlink(K_PATH_CACHE.$file_name);
}
}
closedir($handle);
}
}
$preserve = array(