note 87663 modified in function.ziparchive-addfile by danbrown

From: Date: Mon, 15 Dec 2008 18:47:58 +0000
Subject: note 87663 modified in function.ziparchive-addfile by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148194@lists.php.net to get a copy of this message
This is my workaround for the file descriptor limit by closing/opening the archive file periodically. <?php if($backup = new ZipArchive()) { if($backup->open($zip, ZIPARCHIVE::OVERWRITE) === true) { $backup->addFile($file['realpath'], $file['path']); if(($count++) == 200) { // the file descriptor limit $backup->close(); if($backup = new ZipArchive()) { $backup->open($zip); $count = 0; } } } $backup->close(); } ?> Hope it helps someone. --was-- This is my workaround for the file descriptor limit by closing/opening the archive file periodically. if($backup = new ZipArchive()) { if($backup->open($zip, ZIPARCHIVE::OVERWRITE) === true) { $backup->addFile($file['realpath'], $file['path']); if(($count++) == 200) { // the file descriptor limit $backup->close(); if($backup = new ZipArchive()) { $backup->open($zip); $count = 0; } } } $backup->close(); } Hope it helps someone. http://php.net/manual/en/function.ziparchive-addfile.php

« previous php.notes (#148194) next »