function PclZip::privOptionDefaultThreshold in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZip::privOptionDefaultThreshold()
4 calls to PclZip::privOptionDefaultThreshold()
- PclZip::add in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php - PclZip::create in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php - PclZip::extract in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php - PclZip::extractByIndex in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php, line 1826
Class
Code
function privOptionDefaultThreshold(&$p_options) {
$v_result = 1;
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
return $v_result;
}
// ----- Get 'memory_limit' configuration value
$v_memory_limit = ini_get('memory_limit');
$v_memory_limit = trim($v_memory_limit);
$last = strtolower(substr($v_memory_limit, -1));
if ($last == 'g') {
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
$v_memory_limit = $v_memory_limit * 1073741824;
}
if ($last == 'm') {
//$v_memory_limit = $v_memory_limit*1024*1024;
$v_memory_limit = $v_memory_limit * 1048576;
}
if ($last == 'k') {
$v_memory_limit = $v_memory_limit * 1024;
}
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO);
// ----- Sanity check : No threshold if value lower than 1M
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
}
// ----- Return
return $v_result;
}