throw new \Exception('L\'élement ' . $id . ' n\'existe pas dans la médiathèque');
}
$collection = $asset->getMediaInField($asset->getAttributeValue('file_upload'));
- if ((is_array($collection) && count($collection) === 0) || $collection->count() === 0) {
+ if ((is_array($collection) && count($collection) === 0) || $collection->count() === 0 || $asset->getFilesize() === 0) {
throw new \Exception('L\'élement ' . $id . ' de la médiathèque ne contient aucun fichier');
}
return $collection;
$path = $item->getPath();
/** @var $item Media */
$dest = $tmp . '/' . Files::getFilename($path);
- copy($path, $dest);
+ if (file_exists($path)) {
+ copy($path, $dest);
+ }
}
Zip::archive($tmp, $zip);
if (!file_exists($zip)) {