00001 <?php
00002
00003 lt_include( PLOG_CLASS_PATH."class/file/unpacker/baseunpacker.class.php" );
00004 lt_include( PLOG_CLASS_PATH."class/file/unpacker/pclzip.lib.php" );
00005
00019 class ZipUnpacker extends BaseUnpacker
00020 {
00021
00022 function ZipUnpacker()
00023 {
00024 $this->BaseUnpacker();
00025 }
00026
00035 function unpackNative( $file, $destFolder )
00036 {
00037 $z = new PclZip($file);
00038 return $z->extract( $destFolder );
00039 }
00040
00044 function unpack( $file, $destFolder )
00045 {
00046
00047 $config =& Config::getConfig();
00048
00049 if( $config->getValue( "unzip_use_native_version" )) {
00050 return $this->unpackNative( $file, $destFolder );
00051 }
00052 else {
00053 $unzipPath = $config->getValue( "path_to_unzip" );
00054 if( $unzipPath == "" )
00055 $unzipPath = DEFAULT_UNZIP_PATH;
00056
00057 $cmd = "$unzipPath -o $file -d $destFolder";
00058
00059 $result = exec( $cmd, $output, $retval );
00060
00061
00062
00063
00064
00065
00066
00067
00068 return ( $retval == 0 );
00069 }
00070 }
00071 }
00072 ?>