/** * 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 GZipFile($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; }
/** * Uncompresses a gzipped file and returns true if successful. * * @param string $gzipped * @param string $destination * @return boolean */ public static function uncompressFile($gzipped, $destination) { if (!@is_file($gzipped)) { return false; } $sourceFile = new GZipFile($gzipped, 'rb'); //$filesize = $sourceFile->getFileSize(); $targetFile = new File($destination); while (!$sourceFile->eof()) { $targetFile->write($sourceFile->read(512), 512); } $targetFile->close(); $sourceFile->close(); self::makeWritable($destination); return true; }