Check for file exists before adding to zip. Adding a non existent file to ZipArchive can lead to archive not being created
parent
e4266efb22
commit
52723ad933
|
@ -1586,8 +1586,8 @@ Class H5PExport {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
// Please note that the zip format has no concept of folders, we must
|
// Please note that the zip format has no concept of folders, we must
|
||||||
// use forward slashes to separate our directories.
|
// use forward slashes to separate our directories.
|
||||||
$zip->addFile($file->absolutePath, $file->relativePath);
|
if (file_exists($file->absolutePath)) $zip->addFile($file->absolutePath, $file->relativePath);
|
||||||
$zip->addFile($rootPrefix . $file->absolutePath, $file->relativePath);
|
if (file_exists($rootPrefix . $file->absolutePath)) $zip->addFile($rootPrefix . $file->absolutePath, $file->relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close zip and remove tmp dir
|
// Close zip and remove tmp dir
|
||||||
|
|
Loading…
Reference in New Issue