Opened 15 years ago
Closed 15 years ago
#10403 closed enhancement (fixed)
Consider using the PHP ZIP extension to extract Zip's if available
Reported by: | dd32 | Owned by: | dd32 |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Upgrade/Install | Keywords: | featured |
Focuses: | Cc: |
Description
WordPress should use the PHP Zip extension if available to decompress zip files, It should be more efficient than a PHP-based uncompress routine..
Change History (13)
#2
@
15 years ago
If someone else doesnt implement this, i'll get it done before next release.. I've got other uses for that code :)
#3
@
15 years ago
- Keywords needs-patch removed
Then leaving this to you should be the best. The "needs-patch" keyboard is no longer needed :)
#8
@
15 years ago
- Milestone changed from Future Release to 3.0
I've just written up a version which uses the ZipArchive class (Only available with the PHP Zip extension loaded).
When running locally on my system(extracting the wordpress 2.9.1 package via WP_Filesystem_Direct), the output of ZipArchive and PclZip appear to match exactly.
Both take approximately the same ammount of time locally.
ZipArchive uses on peak average, 2.25MB of memory. PclZip uses on peak average 11.70MB of memory (approximately the same size as the Compressed file & uncompressed files).
Code used for testing:
WP_Filesystem( array('hostname' => '', 'username' => '', 'password' => '') ); add_filter('unzip_file_use_ziparchive', 'return_true'); function return_false() { return false; } // Use PclZip function return_true() { return true; } // Use ZipArchive timer_start(); var_dump( memory_get_peak_usage(true) ); var_dump( unzip_file(ABSPATH . 'wordpress-2.9.1.zip', ABSPATH . 'test' . time()) ) timer_stop(1, 5); var_dump( memory_get_peak_usage(true) );
+1. The extension is automatically installed in PHP Windows releases since 5.3.0.