readme.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. // --------------------------------------------------------------------------------
  2. // PclZip 2.8.2 - readme.txt
  3. // --------------------------------------------------------------------------------
  4. // License GNU/LGPL - August 2009
  5. // Vincent Blavet - vincent@phpconcept.net
  6. // http://www.phpconcept.net
  7. // --------------------------------------------------------------------------------
  8. // $Id: readme.txt,v 1.60 2009/09/30 20:35:21 vblavet Exp $
  9. // --------------------------------------------------------------------------------
  10. 0 - Sommaire
  11. ============
  12. 1 - Introduction
  13. 2 - What's new
  14. 3 - Corrected bugs
  15. 4 - Known bugs or limitations
  16. 5 - License
  17. 6 - Warning
  18. 7 - Documentation
  19. 8 - Author
  20. 9 - Contribute
  21. 1 - Introduction
  22. ================
  23. PclZip is a library that allow you to manage a Zip archive.
  24. Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
  25. 2 - What's new
  26. ==============
  27. Version 2.8.2 :
  28. - PCLZIP_CB_PRE_EXTRACT and PCLZIP_CB_POST_EXTRACT are now supported with
  29. extraction as a string (PCLZIP_OPT_EXTRACT_AS_STRING). The string
  30. can also be modified in the post-extract call back.
  31. **Bugs correction :
  32. - PCLZIP_OPT_REMOVE_ALL_PATH was not working correctly
  33. - Remove use of eval() and do direct call to callback functions
  34. - Correct support of 64bits systems (Thanks to WordPress team)
  35. Version 2.8.1 :
  36. - Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
  37. deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
  38. automatically replace it by PCLZIP_OPT_BY_PREG.
  39. Version 2.8 :
  40. - Improve extraction of zip archive for large files by using temporary files
  41. This feature is working like the one defined in r2.7.
  42. Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
  43. PCLZIP_OPT_TEMP_FILE_THRESHOLD
  44. - Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
  45. sense of temporary file use.
  46. - Bug correction : Reduce filepath in returned file list to remove ennoying
  47. './/' preambule in file path.
  48. Version 2.7 :
  49. - Improve creation of zip archive for large files :
  50. PclZip will now autosense the configured memory and use temporary files
  51. when large file is suspected.
  52. This feature can also ne triggered by manual options in create() and add()
  53. methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
  54. 'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
  55. 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
  56. threshold to use temporary files.
  57. Using "temporary files" rather than "memory" might take more time, but
  58. might give the ability to zip very large files :
  59. Tested on my win laptop with a 88Mo file :
  60. Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
  61. Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
  62. - Replace use of mktime() by time() to limit the E_STRICT error messages.
  63. - Bug correction : When adding files with full windows path (drive letter)
  64. PclZip is now working. Before, if the drive letter is not the default
  65. path, PclZip was not able to add the file.
  66. Version 2.6 :
  67. - Code optimisation
  68. - New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
  69. add a comment for a specific file. (Don't really know if this is usefull)
  70. - New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
  71. as a file.
  72. - New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
  73. a file.
  74. - Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
  75. with current time
  76. - Add CRC value in the informations returned back for each file after an
  77. action.
  78. - Add missing closedir() statement.
  79. - When adding a folder, and removing the path of this folder, files were
  80. incorrectly added with a '/' at the beginning. Which means files are
  81. related to root in unix systems. Corrected.
  82. - Add conditional if before constant definition. This will allow users
  83. to redefine constants without changing the file, and then improve
  84. upgrade of pclzip code for new versions.
  85. Version 2.5 :
  86. - Introduce the ability to add file/folder with individual properties (file descriptor).
  87. This gives for example the ability to change the filename of a zipped file.
  88. . Able to add files individually
  89. . Able to change full name
  90. . Able to change short name
  91. . Compatible with global options
  92. - New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
  93. - New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
  94. - Add a security control feature. PclZip can extract any file in any folder
  95. of a system. People may use this to upload a zip file and try to override
  96. a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
  97. ability to forgive any directory transversal behavior.
  98. - New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
  99. - New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
  100. - Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
  101. by current path (getcwd())
  102. Version 2.4 :
  103. - Code improvment : try to speed up the code by removing unusefull call to pack()
  104. - Correct bug in delete() : delete() should be called with no argument. This was not
  105. the case in 2.3. This is corrected in 2.4.
  106. - Correct a bug in path_inclusion function. When the path has several '../../', the
  107. result was bad.
  108. - Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
  109. disable it while working and det it back to its original value.
  110. This resolve a lots of bad formated archive errors.
  111. - Bug correction : PclZip now correctly unzip file in some specific situation,
  112. when compressed content has same size as uncompressed content.
  113. - Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
  114. directories are not any more created.
  115. - Code improvment : correct unclosed opendir(), better handling of . and .. in
  116. loops.
  117. Version 2.3 :
  118. - Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
  119. give the same result in PHP4 and PHP5 ....
  120. Version 2.2 :
  121. - Try development of PCLZIP_OPT_CRYPT .....
  122. However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
  123. the result (greater than a long) is not supported by PHP. Even the use of bcmath
  124. functions does not help. I did not find yet a solution ...;
  125. - Add missing '/' at end of directory entries
  126. - Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
  127. error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
  128. - Corrected : Bad "version need to extract" field in local file header
  129. - Add private method privCheckFileHeaders() in order to check local and central
  130. file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
  131. the ability to have a local file header without size, compressed size and crc filled.
  132. - Add a generic status 'error' for file status
  133. - Add control of compression type. PclZip only support deflate compression method.
  134. Before v2.2, PclZip does not check the compression method used in an archive while
  135. extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
  136. compression method. New status is "unsupported_compression". New error code is
  137. PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
  138. - Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
  139. when errors like 'a folder with same name exists' or 'a newer file exists' or
  140. 'a write protected file' exists, rather than set a status for the concerning file
  141. and resume the extract of the zip.
  142. - Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
  143. replacement of the file, even if a newer version of the file exists.
  144. Note that today if a file with the same name already exists but is older it will be
  145. replaced by the extracted one.
  146. - Improve PclZipUtilOption()
  147. - Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
  148. directory structure is the last data in the archive. Crypt encryption/decryption of
  149. zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
  150. Version 2.1 :
  151. - Add the ability to abort the extraction by using a user callback function.
  152. The user can now return the value '2' in its callback which indicates to stop the
  153. extraction. For a pre call-back extract is stopped before the extration of the current
  154. file. For a post call back, the extraction is stopped after.
  155. - Add the ability to extract a file (or several files) directly in the standard output.
  156. This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
  157. - Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
  158. PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
  159. in the zip archive.
  160. - When merging two archives, the comments are not any more lost, but merged, with a
  161. blank space separator.
  162. - Corrected bug : Files are not deleted when all files are asked to be deleted.
  163. - Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
  164. Version 2.0 :
  165. ***** Warning : Some new features may break the backward compatibility for your scripts.
  166. Please carefully read the readme file.
  167. - Add the ability to delete by Index, name and regular expression. This feature is
  168. performed by the method delete(), which uses the optional parameters
  169. PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
  170. - Add the ability to extract by regular expression. To extract by regexp you must use the method
  171. extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
  172. (depending if you want to use ereg() or preg_match() syntax) followed by the
  173. regular expression pattern.
  174. - Add the ability to extract by index, directly with the extract() method. This is a
  175. code improvment of the extractByIndex() method.
  176. - Add the ability to extract by name. To extract by name you must use the method
  177. extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
  178. extract or an array of filenames to extract. To extract all a folder, use the folder
  179. name rather than the filename with a '/' at the end.
  180. - Add the ability to add files without compression. This is done with a new attribute
  181. which is PCLZIP_OPT_NO_COMPRESSION.
  182. - Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
  183. in a string without using any file (or temporary file).
  184. - Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
  185. The default separator is now a comma (,) and not any more a blank space.
  186. THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
  187. your script.
  188. - Improve algorythm performance by removing the use of temporary files when adding or
  189. extracting files in an archive.
  190. - Add (correct) detection of empty filename zipping. This can occurs when the removed
  191. path is the same
  192. as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
  193. - Add better support for windows paths (thanks for help from manus@manusfreedom.com).
  194. - Corrected bug : When the archive file already exists with size=0, the add() method
  195. fails. Corrected in 2.0.
  196. - Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
  197. - Control the order of index ranges in extract by index feature.
  198. - Change the internal management of folders (better handling of internal flag).
  199. Version 1.3 :
  200. - Removing the double include check. This is now done by include_once() and require_once()
  201. PHP directives.
  202. - Changing the error handling mecanism : Remove the use of an external error library.
  203. The former PclError...() functions are replaced by internal equivalent methods.
  204. By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
  205. Introducing the use of constants for error codes rather than integer values. This will help
  206. in futur improvment.
  207. Introduction of error handling functions like errorCode(), errorName() and errorInfo().
  208. - Remove the deprecated use of calling function with arguments passed by reference.
  209. - Add the calling of extract(), extractByIndex(), create() and add() functions
  210. with variable options rather than fixed arguments.
  211. - Add the ability to remove all the file path while extracting or adding,
  212. without any need to specify the path to remove.
  213. This is available for extract(), extractByIndex(), create() and add() functionS by using
  214. the new variable options parameters :
  215. - PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
  216. - Ability to change the mode of a file after the extraction (chmod()).
  217. This is available for extract() and extractByIndex() functionS by using
  218. the new variable options parameters.
  219. - PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
  220. - Ability to definition call-back options. These call-back will be called during the adding,
  221. or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
  222. - PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
  223. can trigerred the change the filename of the extracted file. The user can triggered the
  224. skip of the extraction. This is adding a 'skipped' status in the file list result value.
  225. - PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
  226. Nothing can be triggered from that point.
  227. - PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
  228. can trigerred the change the stored filename of the added file. The user can triggered the
  229. skip of the add. This is adding a 'skipped' status in the file list result value.
  230. - PCLZIP_CB_POST_ADD : will be called after each add of a file.
  231. Nothing can be triggered from that point.
  232. - Two status are added in the file list returned as function result : skipped & filename_too_long
  233. 'skipped' is used when a call-back function ask for skipping the file.
  234. 'filename_too_long' is used while adding a file with a too long filename to archive (the file is
  235. not added)
  236. - Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
  237. a directory.
  238. - Add a check of the presence of the archive file before some actions (like list, ...)
  239. - Add the initialisation of field "index" in header array. This means that by
  240. default index will be -1 when not explicitly set by the methods.
  241. Version 1.2 :
  242. - Adding a duplicate function.
  243. - Adding a merge function. The merge function is a "quick merge" function,
  244. it just append the content of an archive at the end of the first one. There
  245. is no check for duplicate files or more recent files.
  246. - Improve the search of the central directory end.
  247. Version 1.1.2 :
  248. - Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
  249. (see License section).
  250. - Adding the optional support of a static temporary directory. You will need to configure
  251. the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
  252. - Improving the rename() function. In some cases rename() does not work (different
  253. Filesystems), so it will be replaced by a copy() + unlink() functions.
  254. Version 1.1.1 :
  255. - Maintenance release, no new feature.
  256. Version 1.1 :
  257. - New method Add() : adding files in the archive
  258. - New method ExtractByIndex() : partial extract of the archive, files are identified by
  259. their index in the archive
  260. - New method DeleteByIndex() : delete some files/folder entries from the archive,
  261. files are identified by their index in the archive.
  262. - Adding a test of the zlib extension presence. If not present abort the script.
  263. Version 1.0.1 :
  264. - No new feature
  265. 3 - Corrected bugs
  266. ==================
  267. Corrected in Version 2.0 :
  268. - Corrected : During an extraction, if a call-back fucntion is used and try to skip
  269. a file, all the extraction process is stopped.
  270. Corrected in Version 1.3 :
  271. - Corrected : Support of static synopsis for method extract() is broken.
  272. - Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
  273. - Corrected : When an extract is done with a remove_path parameter, the entry for
  274. the directory with exactly the same path is not skipped/filtered.
  275. - Corrected : extractByIndex() and deleteByIndex() were not managing index in the
  276. right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
  277. is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
  278. string and not interger). The sort is temporarilly removed, this means that
  279. you must provide a sorted list of index ranges.
  280. Corrected in Version 1.2 :
  281. - Nothing.
  282. Corrected in Version 1.1.2 :
  283. - Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
  284. Corrected in Version 1.1.1 :
  285. - Corrected : When archived file is not compressed (0% compression), the
  286. extract method fails.
  287. Corrected in Version 1.1 :
  288. - Corrected : Adding a complete tree of folder may result in a bad archive
  289. creation.
  290. Corrected in Version 1.0.1 :
  291. - Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
  292. 4 - Known bugs or limitations
  293. =============================
  294. Please publish bugs reports in SourceForge :
  295. http://sourceforge.net/tracker/?group_id=40254&atid=427564
  296. In Version 2.x :
  297. - PclZip does only support file uncompressed or compressed with deflate (compression method 8)
  298. - PclZip does not support password protected zip archive
  299. - Some concern were seen when changing mtime of a file while archiving.
  300. Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
  301. In Version 1.2 :
  302. - merge() methods does not check for duplicate files or last date of modifications.
  303. In Version 1.1 :
  304. - Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
  305. - WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
  306. add a file in a PclZip created archive. (Corrected in v.1.2)
  307. In Version 1.0.1 :
  308. - Adding a complete tree of folder may result in a bad archive
  309. creation. (Corrected in V.1.1).
  310. - Path given to methods must be in the unix format (/) and not the Windows format (\).
  311. Workaround : Use only / directory separators.
  312. - PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
  313. added suffix. Files with these names may already exist and may be overwritten.
  314. Workaround : none.
  315. - PclZip does not check if the zlib extension is present. If it is absent, the zip
  316. file is not created and the lib abort without warning.
  317. Workaround : enable the zlib extension on the php install
  318. In Version 1.0 :
  319. - Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
  320. (Corrected in v.1.0.1)
  321. - Limitation : Multi-disk zip archive are not supported.
  322. 5 - License
  323. ===========
  324. Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
  325. This library is free, so you can use it at no cost.
  326. HOWEVER, if you release a script, an application, a library or any kind of
  327. code using PclZip library (or a part of it), YOU MUST :
  328. - Indicate in the documentation (or a readme file), that your work
  329. uses PclZip Library, and make a reference to the author and the web site
  330. http://www.phpconcept.net
  331. - Gives the ability to the final user to update the PclZip libary.
  332. I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
  333. be aware that someone is using PclZip.
  334. For more information about GNU/LGPL license : http://www.gnu.org
  335. 6 - Warning
  336. =================
  337. This library and the associated files are non commercial, non professional work.
  338. It should not have unexpected results. However if any damage is caused by this software
  339. the author can not be responsible.
  340. The use of this software is at the risk of the user.
  341. 7 - Documentation
  342. =================
  343. PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
  344. A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
  345. 8 - Author
  346. ==========
  347. This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
  348. 9 - Contribute
  349. ==============
  350. If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
  351. If you can help in financing PhpConcept hosting service, please go to
  352. http://www.phpconcept.net/soutien.php