当前位置: 首页>>代码示例>>PHP>>正文


PHP PclZipUtilCopyBlock函数代码示例

本文整理汇总了PHP中PclZipUtilCopyBlock函数的典型用法代码示例。如果您正苦于以下问题:PHP PclZipUtilCopyBlock函数的具体用法?PHP PclZipUtilCopyBlock怎么用?PHP PclZipUtilCopyBlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PclZipUtilCopyBlock函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: privDeleteByRule


//.........这里部分代码省略.........
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                 return PclZip::errorCode();
             }
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
             // ----- Read the file header
             $v_local_header = array();
             if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) {
                 // TBC
             }
             unset($v_local_header);
             // ----- Write the file header
             if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
             // ----- Read/write the data block
             if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
         }
         // ----- Store the offset of the central dir
         $v_offset = @ftell($v_temp_zip->zip_fd);
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
         // ----- Re-Create the Central Dir files header
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
         for ($i = 0; $i < sizeof($v_header_list); $i++) {
             // ----- Create the file header
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
             if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
                 $v_temp_zip->privCloseFd();
                 $this->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
             // ----- Transform the header to a 'usable' info
             $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
         }
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
         // ----- Zip file comment
         $v_comment = '';
         if (isset($p_options[PCLZIP_OPT_COMMENT])) {
开发者ID:kondrat-shmoylov,项目名称:Pagetest,代码行数:67,代码来源:pclzip.lib.php

示例2: privDeleteByRule


//.........这里部分代码省略.........
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Error log
                 PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
                 // ----- Return
                 return PclZip::errorCode();
             }
             // ----- Read the file header
             $v_local_header = array();
             if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) {
                 // TBC
             }
             unset($v_local_header);
             // ----- Write the file header
             if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Read/write the data block
             if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
         }
         // ----- Store the offset of the central dir
         $v_offset = @ftell($v_temp_zip->zip_fd);
         // ----- Re-Create the Central Dir files header
         for ($i = 0; $i < sizeof($v_header_list); $i++) {
             // ----- Create the file header
             if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
                 $v_temp_zip->privCloseFd();
                 $this->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Transform the header to a 'usable' info
             $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
         }
         // ----- Zip file comment
         $v_comment = '';
         if (isset($p_options[PCLZIP_OPT_COMMENT])) {
             $v_comment = $p_options[PCLZIP_OPT_COMMENT];
         }
         // ----- Calculate the size of the central header
         $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset;
         // ----- Create the central dir footer
         if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
开发者ID:belerweb,项目名称:pigcms,代码行数:67,代码来源:Update.class.php

示例3: privDeleteByIndex


//.........这里部分代码省略.........
     }
     // ----- Look which file need to be kept
     for ($i = 0; $i < sizeof($v_header_list); $i++) {
         PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry : {$i}'");
         // ----- Calculate the position of the header
         PclTraceFctMessage(__FILE__, __LINE__, 2, "Offset='" . $v_header_list[$i]['offset'] . "'");
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : " . ftell($this->zip_fd) . "'");
         @rewind($this->zip_fd);
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : " . ftell($this->zip_fd) . "'");
         if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Error log
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
         }
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : " . ftell($this->zip_fd) . "'");
         // ----- Read the file header
         if (($v_result = $this->privReadFileHeader($v_header_list[$i])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
         // ----- Write the file header
         if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
         PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset for this file is '" . $v_header_list[$i]['offset'] . "'");
         // ----- Read/write the data block
         if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
     }
     // ----- Store the offset of the central dir
     $v_offset = @ftell($v_temp_zip->zip_fd);
     PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : {$v_offset}");
     // ----- Re-Create the Central Dir files header
     for ($i = 0; $i < sizeof($v_header_list); $i++) {
         // ----- Create the file header
         PclTraceFctMessage(__FILE__, __LINE__, 4, "Offset of file : " . $v_header_list[$i]['offset']);
         if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
             $v_temp_zip->privCloseFd();
             $this->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
         // ----- Transform the header to a 'usable' info
         $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
     }
     // ----- Zip file comment
     $v_comment = '';
     // ----- Calculate the size of the central header
     $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset;
     // ----- Create the central dir footer
     if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
         // ----- Reset the file list
         unset($v_header_list);
         $v_temp_zip->privCloseFd();
         $this->privCloseFd();
         @unlink($v_zip_temp_name);
         // ----- Return
         PclTraceFctEnd(__FILE__, __LINE__, $v_result);
         return $v_result;
     }
     // ----- Close
     $v_temp_zip->privCloseFd();
     $this->privCloseFd();
     // ----- Delete the zip file
     // TBC : I should test the result ...
     @unlink($this->zipname);
     // ----- Rename the temporary file
     // TBC : I should test the result ...
     //@rename($v_zip_temp_name, $this->zipname);
     PclZipUtilRename($v_zip_temp_name, $this->zipname);
     // ----- Return
     PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
 }
开发者ID:BackupTheBerlios,项目名称:phreakpic,代码行数:101,代码来源:pclzip-trace.lib.php


注:本文中的PclZipUtilCopyBlock函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。