From: Vincent Vanwaelscappel Date: Fri, 15 Oct 2021 10:39:48 +0000 (+0200) Subject: wip #4793 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fbef3c08f2ecf399f9dac04e3a0a6d85ea532698;p=odl.git wip #4793 @0.5 --- diff --git a/app/Jobs/ProcessFluidbook.php b/app/Jobs/ProcessFluidbook.php index de9c5e6..6c01d38 100644 --- a/app/Jobs/ProcessFluidbook.php +++ b/app/Jobs/ProcessFluidbook.php @@ -64,23 +64,29 @@ class ProcessFluidbook extends Compiler return $fname; } + /** + * @throws \Exception + */ protected function _zipAssets($id) { /** @var Asset $asset */ $asset = Asset::find($id); $collection = $asset->getMediaInField($asset->getAttributeValue('file_upload')); $tmp = Files::tmpdir(); - $zip = Files::tempnam() . '.zip'; + $zip = Files::tempnam($this->wdir) . '.zip'; foreach ($collection as $item) { $path = $item->getPath(); - $spl = new \SplFileInfo($path); /** @var $item Media */ - copy($path, $tmp . $spl->getFilename()); + $dest = $tmp . '/' . Files::getFilename($path); + copy($path, $dest); } Zip::archive($tmp, $zip); + if (!file_exists($zip)) { + throw new \Exception('Error while compressing assets of ' . $id . ' (' . $tmp . ')'); + } Files::rmdir($tmp); - return $zip; + return Files::getFilename($zip); }