PclZipUtilCopyBlock

The WordPress Core PclZipUtilCopyBlock function.

Description

PclZipUtilCopyBlock( $p_src, $p_dest, $p_size, (int) $p_mode = 0 ); 

Parameters (4)

0. $p_src
The src.
1. $p_dest
The dest.
2. $p_size
The size.
3. $p_mode — Optional. (int)
The mode.

Usage

  1. if ( !function_exists( 'PclZipUtilCopyBlock' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/class-pclzip.php'; 
  3.  
  4. // The src. 
  5. $p_src = null; 
  6.  
  7. // The dest. 
  8. $p_dest = null; 
  9.  
  10. // The size. 
  11. $p_size = null; 
  12.  
  13. // The mode. 
  14. $p_mode = -1; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/class-pclzip.php  
  1. function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) 
  2. $v_result = 1; 
  3.  
  4. if ($p_mode==0) 
  5. while ($p_size != 0) 
  6. $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); 
  7. $v_buffer = @fread($p_src, $v_read_size); 
  8. @fwrite($p_dest, $v_buffer, $v_read_size); 
  9. $p_size -= $v_read_size; 
  10. else if ($p_mode==1) 
  11. while ($p_size != 0) 
  12. $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); 
  13. $v_buffer = @gzread($p_src, $v_read_size); 
  14. @fwrite($p_dest, $v_buffer, $v_read_size); 
  15. $p_size -= $v_read_size; 
  16. else if ($p_mode==2) 
  17. while ($p_size != 0) 
  18. $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); 
  19. $v_buffer = @fread($p_src, $v_read_size); 
  20. @gzwrite($p_dest, $v_buffer, $v_read_size); 
  21. $p_size -= $v_read_size; 
  22. else if ($p_mode==3) 
  23. while ($p_size != 0) 
  24. $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); 
  25. $v_buffer = @gzread($p_src, $v_read_size); 
  26. @gzwrite($p_dest, $v_buffer, $v_read_size); 
  27. $p_size -= $v_read_size; 
  28.  
  29. // ----- Return 
  30. return $v_result;