示例#1
0
 /**
  * Uncompresses a gzipped file
  *
  * @param 	string 		$gzipped
  * @param 	string 		$destination
  * @return 	boolean 	result
  */
 public static function uncompressFile($gzipped, $destination)
 {
     if (!@is_file($gzipped)) {
         return false;
     }
     $sourceFile = new ZipFile($gzipped, 'rb');
     $filesize = $sourceFile->getFileSize();
     $targetFile = new File($destination);
     while (!$sourceFile->eof()) {
         $targetFile->write($sourceFile->read(512), 512);
     }
     $targetFile->close();
     $sourceFile->close();
     @$targetFile->chmod(0777);
     if ($filesize != filesize($destination)) {
         @unlink($destination);
         return false;
     }
     return true;
 }