From 7eb7a2f99dddd3ca518b6b42d20058cf190d755c Mon Sep 17 00:00:00 2001 From: vargenau Date: Fri, 3 Oct 2014 16:06:26 +0000 Subject: [PATCH] Remove unused functions gzip_compress and gzip_uncompress git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@9187 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/ziplib.php | 65 -------------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/lib/ziplib.php b/lib/ziplib.php index e06056882..a1d6b1803 100644 --- a/lib/ziplib.php +++ b/lib/ziplib.php @@ -10,71 +10,6 @@ * checksum, and since not all PHP's have gzcompress(), we'll just * stick with gzopen(). */ -function gzip_cleanup() -{ - global $gzip_tmpfile; - - if ($gzip_tmpfile) - @unlink($gzip_tmpfile); -} - -function gzip_tempnam() -{ - global $gzip_tmpfile; - - if (!$gzip_tmpfile) { - //FIXME: does this work on non-unix machines? - if (is_writable("/tmp")) - $gzip_tmpfile = tempnam("/tmp", "wkzip"); - else - $gzip_tmpfile = tempnam(TEMP_DIR, "wkzip"); - register_shutdown_function("gzip_cleanup"); - } - return $gzip_tmpfile; -} - -function gzip_compress($data) -{ - $filename = gzip_tempnam(); - if (!($fp = gzopen($filename, "wb"))) - trigger_error(sprintf("%s failed", 'gzopen'), E_USER_ERROR); - gzwrite($fp, $data, strlen($data)); - if (!gzclose($fp)) { - trigger_error(sprintf("%s failed", 'gzclose'), E_USER_ERROR); - } - $z = NULL; - if (!($fp = fopen($filename, "rb"))) { - trigger_error(sprintf("%s failed", 'fopen'), E_USER_ERROR); - } - while (!feof($fp)) { - $z .= fread($fp, 1024); - } - if (!fclose($fp)) - trigger_error(sprintf("%s failed", 'fclose'), E_USER_ERROR); - unlink($filename); - return $z; -} - -function gzip_uncompress($data) -{ - $filename = gzip_tempnam(); - if (!($fp = fopen($filename, "wb"))) - trigger_error(sprintf("%s failed", 'fopen'), E_USER_ERROR); - fwrite($fp, $data, strlen($data)); - if (!fclose($fp)) - trigger_error(sprintf("%s failed", 'fclose'), E_USER_ERROR); - - if (!($fp = gzopen($filename, "rb"))) - trigger_error(sprintf("%s failed", 'gzopen'), E_USER_ERROR); - $unz = ''; - while ($buf = gzread($fp, 4096)) - $unz .= $buf; - if (!gzclose($fp)) - trigger_error(sprintf("%s failed", 'gzclose'), E_USER_ERROR); - - unlink($filename); - return $unz; -} /** * CRC32 computation. Hacked from Info-zip's zip-2.3 source code. -- 2.45.0