# Description: Modified temporary directory from current dir to TMPDIR environment
# variable (defaults to /tmp)
# Author: Federico Gimenez Nieto <fgimenez@coit.es>
# Last-modified: 2010-02-25
Index: libphp-pclzip-2.8.2/pclzip.lib.php
===================================================================
--- libphp-pclzip-2.8.2.orig/pclzip.lib.php 2010-02-25 12:50:23.000000000 +0100
+++ libphp-pclzip-2.8.2/pclzip.lib.php 2010-02-25 12:52:44.000000000 +0100
@@ -63,7 +63,15 @@
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
if (!defined('PCLZIP_TEMPORARY_DIR')) {
- define( 'PCLZIP_TEMPORARY_DIR', '' );
+ // Attempt to honour the TMPDIR environment variable, defaulting to /tmp/
+ $tmp_dir=getenv( 'TMPDIR' );
+ if(empty( $tmp_dir ))
+ $tmp_dir = "/tmp/";
+ // Perhaps TMPDIR is not defined with a trailing slash
+ else if( substr( $tmp_dir, -1 ) != '/')
+ $tmp_dir.="/";
+
+ define( 'PCLZIP_TEMPORARY_DIR', $tmp_dir );
}
// ----- Optional threshold ratio for use of temporary files