note 104668 added to ref.zip

From: Date: Wed, 29 Jun 2011 14:03:38 +0000
Subject: note 104668 added to ref.zip
Groups: php.notes 
Request: Send a blank email to php-notes+get-181040@lists.php.net to get a copy of this message
Fix for the endless Iteratore add the flag FilesystemIterator::SKIP_DOTS <?php class MyZipArchive extends ZipArchive { /** * * Adds a directory recursively. * * @param string $filename The path to the file to add. * * @param string $localname Local name inside ZIP archive. * */ public function addDir($filename, $localname) { $this->addEmptyDir($localname); $iter = new RecursiveDirectoryIterator($filename, FilesystemIterator::SKIP_DOTS); foreach ($iter as $fileinfo) { if (! $fileinfo->isFile() && !$fileinfo->isDir()) { continue; } $method = $fileinfo->isFile() ? 'addFile' : 'addDir'; $this->$method($fileinfo->getPathname(), $localname . '/' . $fileinfo->getFilename()); } } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 86.86.216.51 ---- Manual Page -- http://www.php.net/manual/en/ref.zip.php Edit -- https://master.php.net/note/edit/104668 Del: integrated -- https://master.php.net/note/delete/104668/integrated Del: useless -- https://master.php.net/note/delete/104668/useless Del: bad code -- https://master.php.net/note/delete/104668/bad+code Del: spam -- https://master.php.net/note/delete/104668/spam Del: non-english -- https://master.php.net/note/delete/104668/non-english Del: in docs -- https://master.php.net/note/delete/104668/in+docs Del: other reasons-- https://master.php.net/note/delete/104668 Reject -- https://master.php.net/note/reject/104668 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181040) next »