本文整理汇总了PHP中ZipArchive::getStatusString方法的典型用法代码示例。如果您正苦于以下问题:PHP ZipArchive::getStatusString方法的具体用法?PHP ZipArchive::getStatusString怎么用?PHP ZipArchive::getStatusString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZipArchive
的用法示例。
在下文中一共展示了ZipArchive::getStatusString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractZip
function extractZip($zipFile, $extractTo)
{
//set variables
$path = $extractTo;
$zip = $zipFile;
$zip = new ZipArchive();
if ($zip->open('30 days in Sydney - Peter Carey.epub') === TRUE) {
$zip->extractTo($path, 'content.opf');
$zip->close();
echo 'Achive has been unzipped to ' . $path;
} else {
echo $zip->getStatusString();
zipstatus($zip->getStatusString());
}
}
示例2: ziparchive_status
/**
* Output status of ZipArchive
*
* @return bool
*/
private function ziparchive_status()
{
if ($this->ziparchive->status == 0) {
return TRUE;
}
trigger_error(sprintf(_x('ZipArchive returns status: %s', 'Text of ZipArchive status Message', 'backwpup'), $this->ziparchive->getStatusString()), E_USER_ERROR);
return FALSE;
}
示例3: extract
/**
* @param \SplFileInfo $directory
*
* @return bool
* @throws \Exception
*/
public function extract(\SplFileInfo $directory, \SplFileInfo $destination)
{
$zip = new \ZipArchive();
if (!$zip->open($directory->getPathname()) || !$zip->extractTo($destination->getPathname())) {
throw new \Exception($zip->getStatusString());
}
$zip->close();
return true;
}
示例4: _zipFile
/**
* Archiving the file
*
* @param unknown $filePath
* @param string $preFix
* @param string $debug
* @throws Exception
*/
private static function _zipFile($filePath, $preFix = '', $debug = false)
{
$start = self::_log('== Archiving the file: ' . $filePath, __CLASS__ . '::' . __FUNCTION__, $preFix);
if (!is_file($filePath)) {
throw new Exception("Invalid file: " . $filePath);
}
$zip = new ZipArchive();
$zipFilePath = self::$_outputFileDir . '/' . UDate::now()->format('Y_m_d') . '.zip';
if ($zip->open($zipFilePath, ZipArchive::CREATE) !== TRUE) {
throw new Exception("cannot open file<" . $zipFilePath . ">");
}
if ($zip->addFile($filePath, '/' . basename($filePath) . '.' . UDate::now()->format('Y_m_d_H_i_s')) !== true) {
throw new Exception('Failed add file(' . $filePath . ') to zip file:' . $zipFilePath);
}
self::_log('Add file: ' . $filePath, '', $preFix . self::TAB);
self::_log('Zip file (' . $zipFilePath . ') are now:', '', $preFix . self::TAB);
self::_log('- Contains: ' . $zip->numFiles . ' file(s)', '', $preFix . self::TAB . self::TAB);
self::_log('- Status: ' . $zip->getStatusString(), '', $preFix . self::TAB . self::TAB);
if ($zip->close() !== true) {
throw new Exception('Failed to save the zip file:' . $zipFilePath);
}
self::_log('REMOVING the orginal file: ' . $filePath, '', $preFix . self::TAB);
unlink($filePath);
self::_log('REMOVED', '', $preFix . self::TAB . self::TAB);
self::_log('== Archived', __CLASS__ . '::' . __FUNCTION__, $preFix, $start);
}
示例5: addFromString
public function addFromString($localname, $contents)
{
if (!$this->archive->addFromString($localname, $contents)) {
throw new ArchiveException("Unable to add {$localname} into archive: " . $this->archive->getStatusString());
}
}
示例6: admin_install
/**
* Install action
*/
public function admin_install()
{
$this->set('title_for_layout', __d('hurad', 'Add New Plugin'));
if ($this->request->is('post')) {
$upload = $this->request->data['Plugins']['plugin'];
if ($upload['error']) {
$this->Session->setFlash(__d('hurad', 'File could not be uploaded. Please, try again.'), 'flash_message', ['class' => 'danger']);
$this->redirect(['action' => 'install']);
}
$folder = new Folder(__DIR__ . DS . '../tmp' . DS);
if (!is_writable($folder->pwd())) {
$this->Session->setFlash(__d('hurad', '%s is not writable', $folder->pwd()), 'flash_message', ['class' => 'danger']);
$this->redirect(['action' => 'install']);
}
if ($upload['type'] != 'application/zip') {
$this->Session->setFlash(__d('hurad', 'Just plugin with .zip extension is allowed.'), 'flash_message', ['class' => 'danger']);
$this->redirect(['action' => 'install']);
}
$zipHandler = new ZipArchive();
if (($res = $zipHandler->open($upload['tmp_name'])) !== true) {
$this->Session->setFlash(__d('hurad', 'Zip extraction failed with error: ' . $zipHandler->getStatusString()), 'flash_message', ['class' => 'danger']);
$this->redirect(['action' => 'install']);
}
if ($zipHandler->extractTo(__DIR__ . DS . '../Plugin' . DS)) {
$zipHandler->close();
$this->Session->setFlash(__d('hurad', 'Plugin installed successfully.'), 'flash_message', ['class' => 'success']);
$this->redirect(['action' => 'install']);
}
$zipHandler->close();
$this->Session->setFlash(__d('hurad', 'Plugin installation failed!'), 'flash_message', ['class' => 'danger']);
$this->redirect(['action' => 'install']);
}
}
示例7: round
$theDiv = $theFileSize / 1000000;
$theFileSize = round($theDiv, 1) . " MB";
//round($WhatToRound, $DecimalPlaces)
} else {
$theDiv = $theFileSize / 1000;
$theFileSize = round($theDiv, 1) . " KB";
//round($WhatToRound, $DecimalPlaces)
}
if (!isZipExtension($uploadfile)) {
$zip = new ZipArchive();
$zip->open($hi_jobsdir . $zFile, ZIPARCHIVE::CREATE);
$zip->addFromString("pov.ini", "# povray ini file generated by upload.php\n+Iimg.pov\n+W1920\n+H1080\n+KFF2");
$zip->addFile($uploadfile, "img.pov");
$zip->close();
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->getStatusString() . "\n";
} else {
if (!copy($uploadfile, $hi_jobsdir . $theFileName)) {
die("failed to copy {$uploadfile} to {$hi_jobsdir}{$theFileName}\n");
}
$zName = substr($theFileName, 0, strrpos($theFileName, '.'));
}
$sqName = mysql_real_escape_string($zName);
// TODO: Move job control to a separate tab.
//$query = "INSERT INTO job(name, frames, sliced, rows, count, issued) VALUES ('$sqName', 1, 0, 1080, 1, UNIX_TIMESTAMP());";
//$result = mysql_query($query);
?>
<table cellpadding="5" width="100%">
<tr>
<td align="Center" colspan="2"><b>Upload Successful</b></td>
示例8: create_zip
function create_zip($files1 = array(), $files2 = array(), $files3 = array(), $destination = '', $overwrite = false, $lab_config_id)
{
//if the zip file already exists and overwrite is false, return false
if (file_exists($destination) && !$overwrite) {
return false;
}
//vars
$valid_files1 = array();
$valid_files2 = array();
//if files were passed in...
if (is_array($files1)) {
//cycle through each file
foreach ($files1 as $file) {
//make sure the file exists
if (file_exists($file)) {
$valid_files1[] = $file;
}
}
}
if (is_array($files2)) {
//cycle through each file
foreach ($files2 as $file) {
//make sure the file exists
if (file_exists($file)) {
$valid_files2[] = $file;
}
}
}
if (is_array($files3)) {
//cycle through each file
foreach ($files3 as $file) {
//make sure the file exists
if (file_exists($file)) {
$valid_files3[] = $file;
}
}
}
//create the archive
$zip = new ZipArchive();
//if($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true)
if ($zip->open($destination, ZIPARCHIVE::OVERWRITE) !== true) {
return false;
}
//if we have good files...
if (count($valid_files1)) {
//add the files
foreach ($valid_files1 as $file) {
$file_parts = explode("/", $file);
$zip->addFile($file, "blis_" . $lab_config_id . "/" . $file_parts[4]);
}
}
if (count($valid_files2)) {
//add the files
foreach ($valid_files2 as $file) {
$file_parts = explode("/", $file);
$zip->addFile($file, "blis_revamp/" . $file_parts[4]);
}
}
if (count($valid_files3)) {
//add the files
foreach ($valid_files3 as $file) {
$file_parts = explode("/", $file);
$zip->addFile($file, "langdata/" . $file_parts[2]);
}
}
$timestamp = date("Y-m-d H:i");
$lab_config = LabConfig::getById($lab_config_id);
$site_name = $lab_config->getSiteName();
$readme_content = "";
if ($_SESSION['locale'] != "fr") {
$readme_content = <<<EOF
BLIS Data Backup
================
Facility: {$site_name} .
Backup date and time: {$timestamp} .
To restore data, copy and overwrite folders named "blis_revamp" and "blis_{$lab_config_id}" in "dbdir" directory.
To restore language translation values, copy and overwrite folder named "langdata" in "htdocs" directory.
-
EOF;
} else {
$readme_content = <<<EOF
BLIS Data Backup
================
Facilité: {$site_name} .
Date de sauvegarde et de temps: {$timestamp} .
Pour restaurer les données, de copier et écraser les dossiers nommés "blis_revamp" et "blis_{$lab_config_id}" dans "dbdir" dossier".
Pour restaurer les valeurs de la traduction, copier le répertoire et remplacer le nom "langdata" dans "htdocs" dossier.
-
EOF;
}
$zip->addFromString('readme.txt', $readme_content);
//debug
echo 'The zip archive contains ', $zip->numFiles, ' files with a status of ', $zip->getStatusString();
//close the zip -- done!
$zip->close();
//check to make sure the file exists
return file_exists($destination);
}
示例9: edih_ziptoarray
/**
* Function to deal with zip archives of uploaded files
*
* This function examines the zip archive, checks for unwanted files, unpacks
* the files to the IBR_UPLOAD_DIR, and creates an array of file paths by the
* type of file
*
* @uses ibr_upload_match_file()
* @param string $zipfilename -- the $_FILES['file']['tmp_name'];
* @param array $param_ar -- the parameters array, so we don't have to create it here
* @param string &$html_str -- passed by reference for appending
* @return array $f_ar -- paths to unpacked files accepted by this function
*/
function edih_ziptoarray($zipfilename, $param_ar, $single = false)
{
// note that this function moves files and set permissions, so platform issues may occur
//
$html_str = '';
$edih_upldir = csv_edih_tmpdir();
//
$zip_obj = new ZipArchive();
// open archive (ZIPARCHIVE::CHECKCONS the ZIPARCHIVE::CREATE is supposedly necessary for microsoft)
if ($zip_obj->open($zipfilename, ZIPARCHIVE::CHECKCONS) !== true) {
//$html_str .= "Error: Could not open archive $zipfilename <br />" . PHP_EOL;
csv_edihist_log('edih_ziptoarray: Error: Could not open archive ' . $zipfilename);
$f_zr['reject'][] = array('name' => $zipfilename, 'comment' => 'Error: Could not open archive ' . $zipfilename);
return $f_zr;
}
if ($zip_obj->status != 0) {
$err .= "Error code: " . $zip_obj->status . " " . $zip_obj->getStatusString() . "<br />" . PHP_EOL;
csv_edihist_log('edih_ziptoarray: ' . $zipfilename . ' ' . $err);
$f_zr['reject'][] = array('name' => $zipfilename, 'comment' => $err);
return $f_zr;
}
// initialize output array and counter
$f_zr = array();
$p_ct = 0;
// get number of files
$f_ct = $zip_obj->numFiles;
if ($single && $f_ct > 1) {
csv_edihist_log('edih_ziptoarray: Usage: only single zipped file accepted through this input');
$f_zr['reject'][] = array('name' => $zipfilename, 'comment' => 'Usage: only single zipped file accepted through this input');
return $f_zr;
}
// get the file names
for ($i = 0; $i < $f_ct; $i++) {
//
$isOK = true;
$fstr = "";
$file = $zip_obj->statIndex($i);
$name = $file['name'];
$oldCrc = $file['crc'];
// get file contents
$fstr = stream_get_contents($zip_obj->getStream($name));
if ($fstr) {
// use only the file name
$bnm = basename($name);
$newname = tempnam($edih_upldir, 'edi');
//
// extract the file to unzip tmp dir with read/write access
$chrs = file_put_contents($newname, $fstr);
// test crc
$newCrc = hexdec(hash_file("crc32b", $newname));
//
if ($newCrc !== $oldCrc && $oldCrc + 4294967296.0 !== $newCrc) {
// failure case, mismatched crc file integrity values
$html_str .= "CRC error: The files don't match! Removing file {$bnm} <br />" . PHP_EOL;
$isGone = unlink($newname);
if ($isGone) {
$is_tmpzip = false;
$html_str .= "File Removed {$bnm}<br />" . PHP_EOL;
} else {
$html_str .= "Failed to removed file {$bnm}<br />" . PHP_EOL;
}
} else {
// passed the CRC test, now type and verify file
$fzp['name'] = $bnm;
$fzp['tmp_name'] = $newname;
// verification checks special to our application
$f_uplz = edih_upload_match_file($param_ar, $fzp, $html_str);
//
if (is_array($f_uplz) && count($f_uplz)) {
if (isset($f_uplz['reject'])) {
$f_zr['reject'][] = $f_uplz['reject'];
} elseif (isset($f_uplz['name'])) {
$f_zr[$f_uplz['type']][] = $f_uplz['name'];
$p_ct++;
}
} else {
// verification failed
$f_zr['reject'][] = array('name' => $fzp['name'], 'comment' => 'verification failed');
}
}
//
} else {
csv_edihist_log("Did not get file contents {$name}");
$isOK = false;
}
}
// end for ($i=0; $i<$numFiles; $i++)
//.........这里部分代码省略.........
示例10: downloadBankslipAction
/**
*
* @throws Exception
*/
public function downloadBankslipAction()
{
$programmedPayments = $this->getRequest()->getParam('programmedPayment');
$actualPayments = ActualPaymentQuery::create()->innerJoinFile()->addColumn('File.*')->whereAdd(ActualPayment::ID_PROGRAMMED_PAYMENT, $programmedPayments)->fetchAll();
$zip = new ZipArchive();
$tempdir = sys_get_temp_dir();
$filePath = tempnam($tempdir, md5(rand()));
$fileName = "bankslip.zip";
$result = $zip->open($filePath, ZipArchive::CREATE);
if ($result === true) {
foreach ($actualPayments as $actualPayment) {
// print_r($actualPayment['content']);die;
if (file_exists($actualPayment['content'])) {
$file = end(explode('/', $actualPayment['content']));
if (!$zip->addFile($actualPayment['content'], $file)) {
throw new Exception("A file cannot be added to the zip folder");
}
}
}
$zip->close();
if (false !== fopen($filePath, 'r')) {
$fileBytes = readfile($filePath);
if (!$fileBytes) {
throw new Exception('The file is completly empty');
}
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
die;
} else {
throw new Exception('The ZIP file cannot be created');
}
} else {
echo $zip->getStatusString();
die;
throw new Exception($result);
}
}
示例11: csv_zip_dir
/**
* Creates a zip archive of the files in the $filename_ar array and
* returns the path/name of the archive or FALSE on error
*
* @param array $parameters array for file type from csv_parameters
* @param array $filename_ar filenames to be archived
* @param string $archive_date date of archive to be incorporated in archive file name
* @return mixed either the name of the zip archive or FALSE in case or error
*/
function csv_zip_dir($parameters, $filename_ar, $archive_date)
{
// we deal with possible maximum files issues by chunking the $fn_ar array
//$ulim = array();
//exec("ulimit -a | grep 'open files'", $ulim); open files (-n) 1024
//
$f_max = 200;
$fn_ar2 = array();
if (count($filename_ar) > $f_max) {
$fn_ar2 = array_chunk($filename_ar, $f_max);
} else {
$fn_ar2[] = $filename_ar;
}
//
$zpath = csv_edih_basedir();
$ztemp = csv_edih_tmpdir();
$zip_name = $zpath . DIRECTORY_SEPARATOR . "archive" . DIRECTORY_SEPARATOR . $type . "_{$archive_date}.zip";
$ftmpn = $ztemp . DIRECTORY_SEPARATOR;
$fdir = $parameters['directory'] . DIRECTORY_SEPARATOR;
$type = $parameters['type'];
//
$zip_obj = new ZipArchive();
//
foreach ($fn_ar2 as $fnz) {
// reopen the zip archive on each loop so the open file count is controlled
if (is_file($zip_name)) {
$isOK = $zip_obj->open($zip_name, ZIPARCHIVE::CHECKCONS);
$isNew = FALSE;
} else {
$isOK = $zip_obj->open($zip_name, ZIPARCHIVE::CREATE);
$isNew = $isOK;
}
//
if ($isOK && $isNew) {
$zip_obj->addEmptyDir($type);
$zip_obj->setArchiveComment("archive " . $fdir . "prior to {$archive_date}");
}
//
if ($isOK) {
// we are working with the open archive
// now add the files to the archive
foreach ($fnz as $fz) {
if (is_file($fdir . $fz)) {
$iscp = copy($fdir . $fz, $ftmpn . $fz);
$isOK = $zip_obj->addFile($ftmpn . $fz, $type . DIRECTORY_SEPARATOR . $fz);
} else {
csv_edihist_log("csv_zip_dir: in record, but not in directory {$fz} ");
// possible that file is in csv table, but not in directory?
}
//
if ($isOK && $iscp) {
// if we have added the file to the archive, remove it from the storage directory
// but keep the /tmp file copy for now
unlink($fdir . $fz);
} else {
$msg = $zip_obj->getStatusString();
csv_edihist_log("csv_zip_dir: {$type} ZipArchive failed for {$fz} {$msg}");
}
}
// end foreach
} else {
// ZipArchive open() failed -- try to get the error message and return false
$msg = $zip_obj->getStatusString();
csv_edihist_log("csv_zip_dir: {$type} ZipArchive open() failed {$msg}");
return $isOK;
}
//
// errors on close would be non-existing file added or something else
$isOK = $zip_obj->close($zip_name);
if (!$isOK) {
$msg = $zip_obj->getStatusString();
csv_edihist_log("csv_zip_dir: {$type} ZipArchive close() error for {$fz} {$msg}");
//
return $isOK;
}
}
// end foreach($fn_ar2 as $fnz)
//
return $isOK ? $zip_name : $isOK;
}
示例12: edih_archive_restore
/**
* Unpack an existing archive and restore it to current csv records
* and replace the files in the respective directories
*
* @uses edih_archive_csv_combine
* @param string
*
* @return string
*/
function edih_archive_restore($archive_name)
{
//
$str_out = '';
$bdir = csv_edih_basedir();
$tmpdir = csv_edih_tmpdir();
$archdir = $bdir . DS . 'archive';
//
if (is_file($archdir . DS . $archive_name)) {
$arch = realpath($archdir . DS . $archive_name);
$str_out .= "Archive: restoring {$archive_name}<br>";
csv_edihist_log("edih_archive_restore: restoring {$archive_name}");
} else {
$str_out = "Archive: restore archive bad file name {$archive_name} <br>";
csv_edihist_log("edih_archive_restore: restore archive bad file name {$archive_name}");
return $str_out;
}
//
$zip_obj = new ZipArchive();
// open archive (ZIPARCHIVE::CHECKCONS the ZIPARCHIVE::CREATE is supposedly necessary for microsoft)
//$res = $zip_obj->open($arch, ZIPARCHIVE::CHECKCONS);
if ($zip_obj->open($arch, ZIPARCHIVE::CHECKCONS) === true) {
$f_ct = $zip_obj->numFiles;
$str_out .= "Extracting {$f_ct} items from {$archive_name} <br>";
csv_edihist_log("edih_archive_restore: Extracting {$f_ct} items from {$archive_name}");
$isOK = $zip_obj->extractTo($tmpdir);
if (!$isOK) {
$msg = $zip_obj->getStatusString();
csv_edihist_log("edih_archive_restore: error extracting archive");
$str_out .= "Archive: error extracting archive {$archive_name} <br>";
$str_out .= "zipArchive: {$msg} <br>";
return $str_out;
}
} else {
$msg = $zip_obj->getStatusString();
csv_edihist_log("edih_archive_restore: error opening archive");
$str_out .= "Archive: error opening archive <br>" . PHP_EOL;
$str_out .= "zipArchive: {$msg} <br>";
return $str_out;
}
// now traverse the tmpdir and replace things
// we should have tmp/csv/files_[ftype].csv claims_[ftype].csv
// tmp/[ftype]/x12_filenames
$arch_ar = scandir($tmpdir);
$tpstr = '';
foreach ($arch_ar as $fa) {
if ($fa == '.' || $fa == '..') {
continue;
}
if (is_dir($tmpdir . DS . $fa)) {
if ($fa == 'csv') {
continue;
}
// if a /history/ftype dir exists
if (is_dir($bdir . DS . $fa)) {
$type_ar[] = $fa;
$tpstr .= "{$fa} ";
}
} else {
continue;
}
}
//
csv_edihist_log("edih_archive_restore: types in archive {$tpstr}");
$str_out .= "Archive: types in archive {$tpstr} <br>" . PHP_EOL;
//
foreach ($type_ar as $ft) {
$str_out .= "Archive: now restoring {$ft}<br>" . PHP_EOL;
csv_edihist_log("edih_archive_restore: now restoring {$ft}");
//
$frows = edih_archive_csv_combine($ft, 'file');
csv_edihist_log("edih_archive_restore: files_{$ft} csv combined rows {$frow}");
$crows = edih_archive_csv_combine($ft, 'claim');
csv_edihist_log("edih_archive_restore: claims_{$ft} csv combined rows {$frow}");
//
$file_ar = scandir($tmpdir . DS . $ft);
foreach ($file_ar as $fn) {
if ($fn == '.' || $fn == '..') {
continue;
}
if (is_file($tmpdir . DS . $ft . DS . $fn)) {
$rn = rename($tmpdir . DS . $ft . DS . $fn, $bdir . DS . $ft . DS . $fn);
if (!$rn) {
$str_out .= " -- error restoring " . $ft . DS . $fn . "<br>" . PHP_EOL;
csv_edihist_log("edih_archive_restore: error restoring " . $ft . DS . $fn);
}
}
}
// this will catch the csv files for the particulat type
$str_out .= "Archive: now replacing csv tables for {$ft}<br>" . PHP_EOL;
csv_edihist_log("edih_archive_restore: now replacing csv tables for {$ft}");
//.........这里部分代码省略.........
示例13: dirname
<?php
$dirname = dirname(__FILE__) . '/';
$arch = new ZipArchive();
$arch->open($dirname . 'foo.zip', ZIPARCHIVE::CREATE);
var_dump($arch->getStatusString());
//delete an index that does not exist - trigger error
$arch->deleteIndex(2);
var_dump($arch->getStatusString());
$arch->close();
unlink($dirname . 'foo.zip');
示例14: ZipArchive
function _unzip_file($zip)
{
$myZip = new ZipArchive();
$myZip->open($zip);
if ($myZip->getStatusString() == 'No error') {
$installDir = INSTALLER_DIR;
$temporaryDir = explode('.', $zip);
$temporaryDir = explode('/', $temporaryDir[0]);
$temporaryDir = $temporaryDir[1];
if (!is_dir($installDir . $temporaryDir)) {
mkdir($installDir . $temporaryDir);
}
if ($myZip->extractTo($installDir . $temporaryDir)) {
// $notice = is_file( $installDir . $temporaryDir . '/notice.html' ) ? fopen( $installDir . $temporaryDir . '/notice.html','r') : '';
$myZip->close();
unlink($zip);
return array('temp_dir' => $temporaryDir, 'notice' => '');
} else {
$myZip->close();
unlink($zip);
$this->drop($installDir . $temporaryDir);
return 'error-occured';
}
$myZip->close();
}
$myZip->close();
if (is_file($zip)) {
unlink($zip);
}
return 'CorruptedArchive';
}
示例15: _zipFiles
private function _zipFiles($zipPath)
{
$zip = new ZipArchive();
$zlibTrue = extension_loaded('zlib') ? "true" : "false ";
if ($zip->open($zipPath, ZIPARCHIVE::OVERWRITE) !== true) {
$error = $zip->getStatusString();
throw new RuntimeException("ZipArchive cannot create '{$zipPath}': {$error}.");
}
foreach ($this->_filePaths as $path) {
if (preg_match('/.*\\-(part.+\\.pdf)/', $path, $matches)) {
$toFilename = $matches[1];
} else {
$toFilename = basename($path);
}
$zip->addFile($path, $toFilename);
_log("Added '{$toFilename}' to zip '{$zipPath}'.");
}
_log("Closing zip file.");
$zip->close();
_log(memory_get_peak_usage());
}