src/Gzip.php
public static function uncompressFile($filepathSrc, $filepathDst = null)
	{
		if (!isset($filepathDst)) {
			$regex = '#^(.+).gz$#';
			$filepathDst = preg_replace($regex, '$1', $filepathSrc);
		} elseif (is_dir($filepathDst)) {
			$pathInfo = pathinfo($filepathSrc);
			$filename = preg_replace($filename, '$1', $pathInfo['filename']);
			$filepathDst = $pathInfo['dirname'].'/'.$filename;
		}
		$return = $filepathDst;
		if ($filepathDst == $filepathSrc) {
			// @todo
			$return = false;
		} elseif ($fpIn = gzopen($filepathSrc, 'rb')) {
			if ($fpOut = fopen($filepathDst, 'wb')) {
				while (!gzeof($fpIn)) {
					fwrite($fpOut, gzread($fpIn, 1024*512));
				}
			} else {
				$return = false;
			}
		} else {
			$return = false;
		}
		return $return;
	}
public static function uncompressFile($filepathSrc, $filepathDst = null)
	{
		if (!isset($filepathDst)) {
			$regex = '#^(.+).gz$#';
			$filepathDst = preg_replace($regex, '$1', $filepathSrc);
		} elseif (is_dir($filepathDst)) {
			$pathInfo = pathinfo($filepathSrc);
			$filename = preg_replace($filename, '$1', $pathInfo['filename']);
			$filepathDst = $pathInfo['dirname'].'/'.$filename;
		}
		$return = $filepathDst;
		if ($filepathDst == $filepathSrc) {
			// @todo
			$return = false;
		} elseif ($fpIn = gzopen($filepathSrc, 'rb')) {
			if ($fpOut = fopen($filepathDst, 'wb')) {
				while (!gzeof($fpIn)) {
					fwrite($fpOut, gzread($fpIn, 1024*512));
				}
			} else {
				$return = false;
			}
		} else {
			$return = false;
		}
		return $return;
	}
public static function uncompressFile ( $ filepathSrc , $ filepathDst = null ) { if ( ! isset ( $ filepathDst ) ) { $ regex = '#^(.+).gz$#' ; $ filepathDst = preg_replace ( $ regex , '$1' , $ filepathSrc ) ; } elseif ( is_dir ( $ filepathDst ) ) { $ pathInfo = pathinfo ( $ filepathSrc ) ; $ filename = preg_replace ( $ filename , '$1' , $ pathInfo [ 'filename' ] ) ; $ filepathDst = $ pathInfo [ 'dirname' ] . '/' . $ filename ; } $ return = $ filepathDst ; if ( $ filepathDst == $ filepathSrc ) { // @todo $ return = false ; } elseif ( $ fpIn = gzopen ( $ filepathSrc , 'rb' ) ) { if ( $ fpOut = fopen ( $ filepathDst , 'wb' ) ) { while ( ! gzeof ( $ fpIn ) ) { fwrite ( $ fpOut , gzread ( $ fpIn , 1024 * 512 ) ) ; } } else { $ return = false ; } } else { $ return = false ; } return $ return ; }
Uncompress gziped file

@param string $filepathSrc input file
@param string $filepathDst optional output file (or output directory)

@return string|false path to uncomperssed file
Uncompress gziped file