public function rebuildZipFile($workshopId) { $documents = $this->getDocumentsForWorkshop($workshopId); $config = Zend_Registry::get('config'); if (!is_readable($config->user->fileUploadPathWorkshop->val)) { throw new Ot_Exception_Data('Target directory is not readable'); } $zip = new Zip($config->user->fileUploadPathWorkshop->val . '/' . $workshopId . '/all_handouts.zip'); $filesToAdd = array(); foreach ($documents as $d) { $target = $config->user->fileUploadPathWorkshop->val . '/' . $workshopId . '/' . $d['name']; if (is_file($target)) { $filesToAdd[] = $target; } else { throw new Ot_Exception_Data('File not found: ' . $target); } } $zip->addFiles($filesToAdd); $zip->createZipFile(); }