210 // Creates a PclZip object and set the name of the associated Zip archive |
210 // Creates a PclZip object and set the name of the associated Zip archive |
211 // filename. |
211 // filename. |
212 // Note that no real action is taken, if the archive does not exist it is not |
212 // Note that no real action is taken, if the archive does not exist it is not |
213 // created. Use create() for that. |
213 // created. Use create() for that. |
214 // -------------------------------------------------------------------------------- |
214 // -------------------------------------------------------------------------------- |
215 function PclZip($p_zipname) |
215 function __construct($p_zipname) |
216 { |
216 { |
217 |
217 |
218 // ----- Tests the zlib |
218 // ----- Tests the zlib |
219 if (!function_exists('gzopen')) |
219 if (!function_exists('gzopen')) |
220 { |
220 { |
1833 } |
1837 } |
1834 |
1838 |
1835 // ----- Get 'memory_limit' configuration value |
1839 // ----- Get 'memory_limit' configuration value |
1836 $v_memory_limit = ini_get('memory_limit'); |
1840 $v_memory_limit = ini_get('memory_limit'); |
1837 $v_memory_limit = trim($v_memory_limit); |
1841 $v_memory_limit = trim($v_memory_limit); |
|
1842 $v_memory_limit_int = (int) $v_memory_limit; |
1838 $last = strtolower(substr($v_memory_limit, -1)); |
1843 $last = strtolower(substr($v_memory_limit, -1)); |
1839 |
1844 |
1840 if($last == 'g') |
1845 if($last == 'g') |
1841 //$v_memory_limit = $v_memory_limit*1024*1024*1024; |
1846 //$v_memory_limit_int = $v_memory_limit_int*1024*1024*1024; |
1842 $v_memory_limit = $v_memory_limit*1073741824; |
1847 $v_memory_limit_int = $v_memory_limit_int*1073741824; |
1843 if($last == 'm') |
1848 if($last == 'm') |
1844 //$v_memory_limit = $v_memory_limit*1024*1024; |
1849 //$v_memory_limit_int = $v_memory_limit_int*1024*1024; |
1845 $v_memory_limit = $v_memory_limit*1048576; |
1850 $v_memory_limit_int = $v_memory_limit_int*1048576; |
1846 if($last == 'k') |
1851 if($last == 'k') |
1847 $v_memory_limit = $v_memory_limit*1024; |
1852 $v_memory_limit_int = $v_memory_limit_int*1024; |
1848 |
1853 |
1849 $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); |
1854 $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO); |
1850 |
1855 |
1851 |
1856 |
1852 // ----- Sanity check : No threshold if value lower than 1M |
1857 // ----- Sanity check : No threshold if value lower than 1M |
1853 if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { |
1858 if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { |
1854 unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); |
1859 unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); |