[wp-trac] [WordPress Trac] #10403: Consider using the PHP ZIP extension to extract Zip's if available
WordPress Trac
wp-trac at lists.automattic.com
Sun Feb 7 04:50:02 UTC 2010
#10403: Consider using the PHP ZIP extension to extract Zip's if available
-----------------------------+----------------------------------------------
Reporter: dd32 | Owner: dd32
Type: enhancement | Status: accepted
Priority: normal | Milestone: 3.0
Component: Upgrade/Install | Version: 2.9
Severity: normal | Keywords: featured
-----------------------------+----------------------------------------------
Changes (by dd32):
* milestone: Future Release => 3.0
Comment:
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) );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10403#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list