PclZip::privOptionDefaultThreshold() –

You appear to be a bot. Output may be restricted

Description

Usage

PclZip::privOptionDefaultThreshold( $p_options );

Parameters

$p_options
( mixed ) required

Returns

void

Source

File name: wordpress/wp-admin/includes/class-pclzip.php
Lines:

1 to 35 of 35
  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);
    $v_memory_limit_int = (int) $v_memory_limit;
    $last = strtolower(substr($v_memory_limit, -1));

    if($last == 'g')
        //$v_memory_limit_int = $v_memory_limit_int*1024*1024*1024;
        $v_memory_limit_int = $v_memory_limit_int*1073741824;
    if($last == 'm')
        //$v_memory_limit_int = $v_memory_limit_int*1024*1024;
        $v_memory_limit_int = $v_memory_limit_int*1048576;
    if($last == 'k')
        $v_memory_limit_int = $v_memory_limit_int*1024;

    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*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;
  }
 

 View on GitHub View on Trac