blob: 86d0787b254213f23586193fd779665714c381ca [file] [log] [blame]
Andrey Andreev0ea39292011-12-25 18:48:46 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev0ea39292011-12-25 18:48:46 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev0ea39292011-12-25 18:48:46 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
Andrey Andreev1841e6b2012-01-24 15:30:01 +020012 * bundled with this package in the files license.txt / license.rst. It is
Derek Jonesf4a4bd82011-10-20 12:18:42 -050013 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
Derek Allard2067d1a2008-11-13 22:59:24 +000028/**
29 * Zip Compression Class
30 *
31 * This class is based on a library I found at Zend:
32 * http://www.zend.com/codex.php?id=696&single=1
33 *
34 * The original library is a little rough around the edges so I
35 * refactored it and added several additional methods -- Rick Ellis
36 *
37 * @package CodeIgniter
38 * @subpackage Libraries
39 * @category Encryption
Derek Jonesf4a4bd82011-10-20 12:18:42 -050040 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000041 * @link http://codeigniter.com/user_guide/libraries/zip.html
42 */
Derek Jones37f4b9c2011-07-01 17:56:50 -050043class CI_Zip {
Derek Allard2067d1a2008-11-13 22:59:24 +000044
Timothy Warren86611db2012-04-27 10:06:25 -040045 /**
46 * Zip data in string form
47 *
48 * @var string
49 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020050 public $zipdata = '';
Timothy Warren86611db2012-04-27 10:06:25 -040051
52 /**
53 * Zip data for a directory in string form
54 *
55 * @var string
56 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020057 public $directory = '';
Timothy Warren86611db2012-04-27 10:06:25 -040058
59 /**
60 * Number of files/folder in zip file
61 *
62 * @var int
63 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020064 public $entries = 0;
Timothy Warren86611db2012-04-27 10:06:25 -040065
66 /**
67 * Number of files in zip
68 *
69 * @var int
70 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020071 public $file_num = 0;
Timothy Warren86611db2012-04-27 10:06:25 -040072
73 /**
74 * relative offset of local header
75 *
76 * @var int
77 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020078 public $offset = 0;
Timothy Warren86611db2012-04-27 10:06:25 -040079
80 /**
81 * Reference to time at init
82 *
83 * @var int
84 */
Andrey Andreev0ea39292011-12-25 18:48:46 +020085 public $now;
Derek Allard2067d1a2008-11-13 22:59:24 +000086
Timothy Warren86611db2012-04-27 10:06:25 -040087 /**
88 * Initialize zip compression class
89 *
90 * @return void
91 */
Greg Akera9263282010-11-10 15:26:43 -060092 public function __construct()
Derek Allard2067d1a2008-11-13 22:59:24 +000093 {
Greg Aker5ed19b42010-03-19 12:13:14 -050094 $this->now = time();
Andrey Andreevbb2e5182012-03-26 13:58:12 +030095 log_message('debug', 'Zip Compression Class Initialized');
Derek Allard2067d1a2008-11-13 22:59:24 +000096 }
97
98 // --------------------------------------------------------------------
99
100 /**
101 * Add Directory
102 *
103 * Lets you add a virtual directory into which you can place files.
104 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000105 * @param mixed the directory name. Can be string or array
106 * @return void
107 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200108 public function add_dir($directory)
Derek Allard2067d1a2008-11-13 22:59:24 +0000109 {
Andrey Andreev6c308b72012-02-02 22:03:53 +0200110 foreach ( (array) $directory as $dir)
Derek Allard2067d1a2008-11-13 22:59:24 +0000111 {
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200112 if ( ! preg_match('|.+/$|', $dir))
Derek Allard2067d1a2008-11-13 22:59:24 +0000113 {
114 $dir .= '/';
115 }
116
Greg Aker5ed19b42010-03-19 12:13:14 -0500117 $dir_time = $this->_get_mod_time($dir);
Greg Aker5ed19b42010-03-19 12:13:14 -0500118 $this->_add_dir($dir, $dir_time['file_mtime'], $dir_time['file_mdate']);
Derek Allard2067d1a2008-11-13 22:59:24 +0000119 }
120 }
121
Barry Mienydd671972010-10-04 16:33:58 +0200122 // --------------------------------------------------------------------
Greg Aker5ed19b42010-03-19 12:13:14 -0500123
124 /**
Andrey Andreev6c308b72012-02-02 22:03:53 +0200125 * Get file/directory modification time
Barry Mienydd671972010-10-04 16:33:58 +0200126 *
Andrey Andreev6c308b72012-02-02 22:03:53 +0200127 * If this is a newly created file/dir, we will set the time to 'now'
Greg Aker5ed19b42010-03-19 12:13:14 -0500128 *
Andrey Andreev6c308b72012-02-02 22:03:53 +0200129 * @param string path to file
130 * @return array filemtime/filemdate
Greg Aker5ed19b42010-03-19 12:13:14 -0500131 */
Andrey Andreevb9535c82011-12-26 16:21:17 +0200132 protected function _get_mod_time($dir)
Greg Aker5ed19b42010-03-19 12:13:14 -0500133 {
Thomas Traub98f85b12011-12-05 14:58:29 +0100134 // filemtime() may return false, but raises an error for non-existing files
Andrey Andreev6c308b72012-02-02 22:03:53 +0200135 $date = file_exists($dir) ? filemtime($dir) : getdate($this->now);
Andrey Andreev0ea39292011-12-25 18:48:46 +0200136
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200137 return array(
Andrey Andreev0ea39292011-12-25 18:48:46 +0200138 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2,
139 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']
140 );
Greg Aker5ed19b42010-03-19 12:13:14 -0500141 }
142
Derek Allard2067d1a2008-11-13 22:59:24 +0000143 // --------------------------------------------------------------------
144
145 /**
146 * Add Directory
147 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000148 * @param string the directory name
Andrey Andreev6c308b72012-02-02 22:03:53 +0200149 * @param int
150 * @param int
Derek Allard2067d1a2008-11-13 22:59:24 +0000151 * @return void
152 */
Andrey Andreevb9535c82011-12-26 16:21:17 +0200153 protected function _add_dir($dir, $file_mtime, $file_mdate)
Barry Mienydd671972010-10-04 16:33:58 +0200154 {
Andrey Andreeve34f1a72012-01-10 22:41:52 +0200155 $dir = str_replace('\\', '/', $dir);
Derek Allard2067d1a2008-11-13 22:59:24 +0000156
157 $this->zipdata .=
Greg Aker5ed19b42010-03-19 12:13:14 -0500158 "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00"
159 .pack('v', $file_mtime)
160 .pack('v', $file_mdate)
Derek Allard2067d1a2008-11-13 22:59:24 +0000161 .pack('V', 0) // crc32
162 .pack('V', 0) // compressed filesize
163 .pack('V', 0) // uncompressed filesize
164 .pack('v', strlen($dir)) // length of pathname
165 .pack('v', 0) // extra field length
166 .$dir
167 // below is "data descriptor" segment
168 .pack('V', 0) // crc32
169 .pack('V', 0) // compressed filesize
170 .pack('V', 0); // uncompressed filesize
171
172 $this->directory .=
Greg Aker5ed19b42010-03-19 12:13:14 -0500173 "\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00"
174 .pack('v', $file_mtime)
175 .pack('v', $file_mdate)
Derek Allard2067d1a2008-11-13 22:59:24 +0000176 .pack('V',0) // crc32
177 .pack('V',0) // compressed filesize
178 .pack('V',0) // uncompressed filesize
179 .pack('v', strlen($dir)) // length of pathname
180 .pack('v', 0) // extra field length
181 .pack('v', 0) // file comment length
182 .pack('v', 0) // disk number start
183 .pack('v', 0) // internal file attributes
184 .pack('V', 16) // external file attributes - 'directory' bit set
185 .pack('V', $this->offset) // relative offset of local header
186 .$dir;
187
188 $this->offset = strlen($this->zipdata);
189 $this->entries++;
190 }
Barry Mienydd671972010-10-04 16:33:58 +0200191
Derek Allard2067d1a2008-11-13 22:59:24 +0000192 // --------------------------------------------------------------------
193
194 /**
195 * Add Data to Zip
196 *
197 * Lets you add files to the archive. If the path is included
Andrey Andreev0b5a4862012-02-29 23:44:00 +0200198 * in the filename it will be placed within a directory. Make
Derek Allard2067d1a2008-11-13 22:59:24 +0000199 * sure you use add_dir() first to create the folder.
200 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000201 * @param mixed
202 * @param string
203 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200204 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200205 public function add_data($filepath, $data = NULL)
Barry Mienydd671972010-10-04 16:33:58 +0200206 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000207 if (is_array($filepath))
208 {
209 foreach ($filepath as $path => $data)
210 {
Barry Mienydd671972010-10-04 16:33:58 +0200211 $file_data = $this->_get_mod_time($path);
Greg Aker5ed19b42010-03-19 12:13:14 -0500212 $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']);
Derek Allard2067d1a2008-11-13 22:59:24 +0000213 }
214 }
215 else
216 {
Greg Aker5ed19b42010-03-19 12:13:14 -0500217 $file_data = $this->_get_mod_time($filepath);
Greg Aker5ed19b42010-03-19 12:13:14 -0500218 $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']);
Derek Allard2067d1a2008-11-13 22:59:24 +0000219 }
220 }
221
222 // --------------------------------------------------------------------
223
224 /**
225 * Add Data to Zip
226 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000227 * @param string the file name/path
228 * @param string the data to be encoded
Andrey Andreev6c308b72012-02-02 22:03:53 +0200229 * @param int
230 * @param int
Derek Allard2067d1a2008-11-13 22:59:24 +0000231 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200232 */
Andrey Andreevb9535c82011-12-26 16:21:17 +0200233 protected function _add_data($filepath, $data, $file_mtime, $file_mdate)
Derek Allard2067d1a2008-11-13 22:59:24 +0000234 {
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200235 $filepath = str_replace('\\', '/', $filepath);
Derek Allard2067d1a2008-11-13 22:59:24 +0000236
237 $uncompressed_size = strlen($data);
Derek Jones37f4b9c2011-07-01 17:56:50 -0500238 $crc32 = crc32($data);
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200239 $gzdata = substr(gzcompress($data), 2, -4);
Derek Allard2067d1a2008-11-13 22:59:24 +0000240 $compressed_size = strlen($gzdata);
241
242 $this->zipdata .=
Greg Aker5ed19b42010-03-19 12:13:14 -0500243 "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00"
244 .pack('v', $file_mtime)
245 .pack('v', $file_mdate)
Derek Allard2067d1a2008-11-13 22:59:24 +0000246 .pack('V', $crc32)
247 .pack('V', $compressed_size)
248 .pack('V', $uncompressed_size)
249 .pack('v', strlen($filepath)) // length of filename
250 .pack('v', 0) // extra field length
251 .$filepath
252 .$gzdata; // "file data" segment
253
254 $this->directory .=
Greg Aker5ed19b42010-03-19 12:13:14 -0500255 "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00"
256 .pack('v', $file_mtime)
257 .pack('v', $file_mdate)
Derek Allard2067d1a2008-11-13 22:59:24 +0000258 .pack('V', $crc32)
259 .pack('V', $compressed_size)
260 .pack('V', $uncompressed_size)
261 .pack('v', strlen($filepath)) // length of filename
262 .pack('v', 0) // extra field length
263 .pack('v', 0) // file comment length
264 .pack('v', 0) // disk number start
265 .pack('v', 0) // internal file attributes
266 .pack('V', 32) // external file attributes - 'archive' bit set
267 .pack('V', $this->offset) // relative offset of local header
268 .$filepath;
269
270 $this->offset = strlen($this->zipdata);
271 $this->entries++;
272 $this->file_num++;
273 }
Barry Mienydd671972010-10-04 16:33:58 +0200274
Derek Allard2067d1a2008-11-13 22:59:24 +0000275 // --------------------------------------------------------------------
276
277 /**
278 * Read the contents of a file and add it to the zip
279 *
Andrey Andreev6c308b72012-02-02 22:03:53 +0200280 * @param string
281 * @param bool
Derek Allard2067d1a2008-11-13 22:59:24 +0000282 * @return bool
Barry Mienydd671972010-10-04 16:33:58 +0200283 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200284 public function read_file($path, $preserve_filepath = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000285 {
286 if ( ! file_exists($path))
287 {
288 return FALSE;
289 }
290
291 if (FALSE !== ($data = file_get_contents($path)))
292 {
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200293 $name = str_replace('\\', '/', $path);
Derek Allard2067d1a2008-11-13 22:59:24 +0000294 if ($preserve_filepath === FALSE)
295 {
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200296 $name = preg_replace('|.*/(.+)|', '\\1', $name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000297 }
298
299 $this->add_data($name, $data);
300 return TRUE;
301 }
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200302
Derek Allard2067d1a2008-11-13 22:59:24 +0000303 return FALSE;
304 }
305
306 // ------------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200307
Derek Allard2067d1a2008-11-13 22:59:24 +0000308 /**
309 * Read a directory and add it to the zip.
310 *
311 * This function recursively reads a folder and everything it contains (including
Andrey Andreev16d80662012-01-20 13:26:49 +0200312 * sub-folders) and creates a zip based on it. Whatever directory structure
Derek Allard2067d1a2008-11-13 22:59:24 +0000313 * is in the original file path will be recreated in the zip file.
314 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000315 * @param string path to source
Andrey Andreev6c308b72012-02-02 22:03:53 +0200316 * @param bool
317 * @param bool
Derek Allard2067d1a2008-11-13 22:59:24 +0000318 * @return bool
Phil Sturgeon26872de2010-05-11 11:41:59 +0100319 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200320 public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
Phil Sturgeon26872de2010-05-11 11:41:59 +0100321 {
tschechnikerc8175be2012-04-04 14:47:30 +0300322 $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
Derek Jones2735b3e2010-05-11 08:58:21 -0500323 if ( ! $fp = @opendir($path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000324 {
Phil Sturgeon26872de2010-05-11 11:41:59 +0100325 return FALSE;
326 }
327
328 // Set the original directory root for child dir's to use as relative
329 if ($root_path === NULL)
330 {
tschechnikerc8175be2012-04-04 14:47:30 +0300331 $root_path = dirname($path).DIRECTORY_SEPARATOR;
Phil Sturgeon26872de2010-05-11 11:41:59 +0100332 }
333
334 while (FALSE !== ($file = readdir($fp)))
335 {
Andrey Andreev0ea39292011-12-25 18:48:46 +0200336 if ($file[0] === '.')
Derek Allard2067d1a2008-11-13 22:59:24 +0000337 {
Phil Sturgeon26872de2010-05-11 11:41:59 +0100338 continue;
339 }
340
341 if (@is_dir($path.$file))
342 {
tschechnikerc8175be2012-04-04 14:47:30 +0300343 $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path);
Phil Sturgeon26872de2010-05-11 11:41:59 +0100344 }
Andrey Andreev16d80662012-01-20 13:26:49 +0200345 elseif (FALSE !== ($data = file_get_contents($path.$file)))
Phil Sturgeon26872de2010-05-11 11:41:59 +0100346 {
Tobias Tschech9664cc92012-04-04 15:22:33 +0300347 $name = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path);
Andrey Andreev16d80662012-01-20 13:26:49 +0200348 if ($preserve_filepath === FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000349 {
Andrey Andreev16d80662012-01-20 13:26:49 +0200350 $name = str_replace($root_path, '', $name);
Derek Allard2067d1a2008-11-13 22:59:24 +0000351 }
Andrey Andreev16d80662012-01-20 13:26:49 +0200352 $this->add_data($name.$file, $data);
Derek Allard2067d1a2008-11-13 22:59:24 +0000353 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000354 }
Derek Jones2735b3e2010-05-11 08:58:21 -0500355
Andrey Andreev6c308b72012-02-02 22:03:53 +0200356 closedir($fp);
Phil Sturgeon26872de2010-05-11 11:41:59 +0100357 return TRUE;
Derek Allard2067d1a2008-11-13 22:59:24 +0000358 }
359
360 // --------------------------------------------------------------------
361
362 /**
363 * Get the Zip file
364 *
Andrey Andreev6c308b72012-02-02 22:03:53 +0200365 * @return string (binary encoded)
Barry Mienydd671972010-10-04 16:33:58 +0200366 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200367 public function get_zip()
Derek Allard2067d1a2008-11-13 22:59:24 +0000368 {
369 // Is there any data to return?
Andrey Andreevcfbd15b2012-01-08 06:41:41 +0200370 if ($this->entries === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000371 {
372 return FALSE;
373 }
374
Andrey Andreev0ea39292011-12-25 18:48:46 +0200375 return $this->zipdata
Andrey Andreev6c308b72012-02-02 22:03:53 +0200376 .$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
377 .pack('v', $this->entries) // total # of entries "on this disk"
378 .pack('v', $this->entries) // total # of entries overall
379 .pack('V', strlen($this->directory)) // size of central dir
380 .pack('V', strlen($this->zipdata)) // offset to start of central dir
381 ."\x00\x00"; // .zip file comment length
Derek Allard2067d1a2008-11-13 22:59:24 +0000382 }
Barry Mienydd671972010-10-04 16:33:58 +0200383
Derek Allard2067d1a2008-11-13 22:59:24 +0000384 // --------------------------------------------------------------------
385
386 /**
387 * Write File to the specified directory
388 *
389 * Lets you write a file
390 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000391 * @param string the file name
392 * @return bool
Barry Mienydd671972010-10-04 16:33:58 +0200393 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200394 public function archive($filepath)
Derek Allard2067d1a2008-11-13 22:59:24 +0000395 {
396 if ( ! ($fp = @fopen($filepath, FOPEN_WRITE_CREATE_DESTRUCTIVE)))
397 {
398 return FALSE;
399 }
400
Barry Mienydd671972010-10-04 16:33:58 +0200401 flock($fp, LOCK_EX);
Derek Allard2067d1a2008-11-13 22:59:24 +0000402 fwrite($fp, $this->get_zip());
403 flock($fp, LOCK_UN);
404 fclose($fp);
405
Barry Mienydd671972010-10-04 16:33:58 +0200406 return TRUE;
Derek Allard2067d1a2008-11-13 22:59:24 +0000407 }
408
409 // --------------------------------------------------------------------
410
411 /**
412 * Download
413 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000414 * @param string the file name
Andrey Andreev0b5a4862012-02-29 23:44:00 +0200415 * @return void
Derek Allard2067d1a2008-11-13 22:59:24 +0000416 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200417 public function download($filename = 'backup.zip')
Derek Allard2067d1a2008-11-13 22:59:24 +0000418 {
Andrey Andreeve34f1a72012-01-10 22:41:52 +0200419 if ( ! preg_match('|.+?\.zip$|', $filename))
Derek Allard2067d1a2008-11-13 22:59:24 +0000420 {
421 $filename .= '.zip';
422 }
423
Derek Allard2067d1a2008-11-13 22:59:24 +0000424 $CI =& get_instance();
425 $CI->load->helper('download');
Derek Allard8dc2c7c2009-12-07 16:07:15 +0000426 $get_zip = $this->get_zip();
Derek Allard8dc2c7c2009-12-07 16:07:15 +0000427 $zip_content =& $get_zip;
428
Derek Allard2067d1a2008-11-13 22:59:24 +0000429 force_download($filename, $zip_content);
430 }
431
432 // --------------------------------------------------------------------
433
434 /**
435 * Initialize Data
436 *
Andrey Andreev16d80662012-01-20 13:26:49 +0200437 * Lets you clear current zip data. Useful if you need to create
Derek Allard2067d1a2008-11-13 22:59:24 +0000438 * multiple zips with different data.
439 *
Andrey Andreev16d80662012-01-20 13:26:49 +0200440 * @return object
Barry Mienydd671972010-10-04 16:33:58 +0200441 */
Andrey Andreev0ea39292011-12-25 18:48:46 +0200442 public function clear_data()
Derek Allard2067d1a2008-11-13 22:59:24 +0000443 {
444 $this->zipdata = '';
445 $this->directory = '';
446 $this->entries = 0;
447 $this->file_num = 0;
448 $this->offset = 0;
Andrey Andreevb9535c82011-12-26 16:21:17 +0200449 return $this;
Derek Allard2067d1a2008-11-13 22:59:24 +0000450 }
Barry Mienydd671972010-10-04 16:33:58 +0200451
Derek Allard2067d1a2008-11-13 22:59:24 +0000452}
453
454/* End of file Zip.php */
Andrey Andreev0336dc22012-03-20 15:34:28 +0200455/* Location: ./system/libraries/Zip.php */