note 99326 added to function.ziparchive-extractto
| From: | RafaelChavesFreitas at osu1 dot php dot net | Date: | Wed, 11 Aug 2010 00:50:27 +0000 |
| Subject: | note 99326 added to function.ziparchive-extractto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171558@lists.php.net to get a copy of this message | ||
this function is based on one of the above functions and adds the overwrite option.
<?php
function unzipFileTo($zippedFilePath, $destinationPath, $overwrite = true){
if (file_exists($zippedFilePath)) {
$files = array();
$zip = new ZipArchive;
if ($zip->open($zippedFilePath) === TRUE) {
for($i = 0; $i < $zip->numFiles; $i++) {
$entry = $zip->getNameIndex($i);
if ($overwrite || (substr( $entry, -1 ) != '/' &&
!file_exists($destinationPath.$entry))){
$files[] = $entry;
}
}
$zip->extractTo($destinationPath, $files);
$zip->close();
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.34.50.23
----
Manual Page -- http://www.php.net/manual/en/function.ziparchive-extractto.php
Edit -- https://master.php.net/note/edit/99326
Del: integrated -- https://master.php.net/note/delete/99326/integrated
Del: useless -- https://master.php.net/note/delete/99326/useless
Del: bad code -- https://master.php.net/note/delete/99326/bad+code
Del: spam -- https://master.php.net/note/delete/99326/spam
Del: non-english -- https://master.php.net/note/delete/99326/non-english
Del: in docs -- https://master.php.net/note/delete/99326/in+docs
Del: other reasons-- https://master.php.net/note/delete/99326
Reject -- https://master.php.net/note/reject/99326
Search -- https://master.php.net/manage/user-notes.php