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


PHP Archive_Tar::isError方法代码示例

本文整理汇总了PHP中Archive_Tar::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP Archive_Tar::isError方法的具体用法?PHP Archive_Tar::isError怎么用?PHP Archive_Tar::isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Archive_Tar的用法示例。


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

示例1: addToArchive

 public function addToArchive(Archive_Tar $archive)
 {
     $rval = $archive->addModify($this->getBasePath() . DIRECTORY_SEPARATOR . $this->getPath(), null, $this->getBasePath());
     if ($archive->isError($rval)) {
         throw new Engine_Package_Manifest_Exception('Error in archive: ' . $rval->getMessage());
     }
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:7,代码来源:File.php

示例2: inflate

 public static function inflate($file, $outputPath)
 {
     // Sanity
     if (!file_exists($file) || !is_file($file) || strtolower(pathinfo($file, PATHINFO_EXTENSION)) != 'tar') {
         throw new Engine_Package_Exception('File does not exist or is not a tar file');
     }
     if (!file_exists($outputPath) || !is_dir($outputPath) || !is_writeable($outputPath)) {
         throw new Engine_Package_Exception('Output path does not exist, is not a directory, or is not writeable');
     }
     self::_loadArchiveClass();
     // Make other paths
     $outputSubPath = substr(basename($file), 0, strrpos(basename($file), '.'));
     $outputFullPath = rtrim($outputPath, '/\\') . DIRECTORY_SEPARATOR . $outputSubPath;
     // If output path already exists, remove
     if (file_exists($outputFullPath)) {
         self::_rmdirRecursive($outputFullPath, true);
     }
     // Try to make full output path
     if (!is_dir($outputFullPath)) {
         if (!mkdir($outputFullPath, 0777, true)) {
             throw new Engine_Package_Exception('Unable to create output folder');
         }
     }
     // Extract
     $archive = new Archive_Tar($file);
     $rval = $archive->extract($outputFullPath);
     // Throw error if failed
     if ($archive->isError($rval)) {
         throw new Engine_Package_Exception('Error in archive: ' . $rval->getMessage());
     }
     return $outputFullPath;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:32,代码来源:Archive.php

示例3: addToArchive

 public function addToArchive(Archive_Tar $archive)
 {
     // Add package file
     $rval = $archive->addString('application' . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . $this->getKey() . '.json', $this->toString('json'));
     if ($archive->isError($rval)) {
         throw new Engine_Package_Manifest_Exception('Error in archive: ' . $rval->getMessage());
     }
     // Add internal structure
     if ($this->getAddDirectoryToArchive()) {
         $rval = $archive->addModify($this->getBasePath() . DIRECTORY_SEPARATOR . $this->getPath(), null, $this->getBasePath());
         if ($archive->isError($rval)) {
             throw new Engine_Package_Manifest_Exception('Error in archive: ' . $rval->getMessage());
         }
     } else {
         foreach ($this->getStructure() as $key => $value) {
             if ($this->_jitInstantiation && is_array($value) && !empty($value['type'])) {
                 $class = 'Engine_Package_Manifest_Entity_' . ucfirst($value['type']);
                 Engine_Loader::loadClass($class);
                 $value = new $class($value);
                 $value->setBasePath($this->getBasePath());
             } else {
                 if (!$value instanceof Engine_Package_Manifest_Entity_Abstract) {
                     throw new Engine_Package_Manifest_Exception('Not a package entity');
                 }
             }
             if (method_exists($value, 'setAddDirectoryToArchive')) {
                 $value->setAddDirectoryToArchive($this->getAddDirectoryToArchive());
             }
             $value->addToArchive($archive);
         }
     }
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:32,代码来源:Package.php

示例4: addToArchive

 public function addToArchive(Archive_Tar $archive)
 {
     if ($this->getAddDirectoryToArchive()) {
         $rval = $archive->addModify($this->getBasePath() . DIRECTORY_SEPARATOR . $this->getPath(), null, $this->getBasePath());
         if ($archive->isError($rval)) {
             throw new Engine_Package_Manifest_Exception('Error in archive: ' . $rval->getMessage());
         }
     } else {
         foreach ($this->getStructure() as $key => $value) {
             $fullpath = $this->getBasePath() . DIRECTORY_SEPARATOR . $this->getPath() . DIRECTORY_SEPARATOR . $value['path'];
             if (is_dir($fullpath)) {
                 continue;
             }
             $rval = $archive->addModify($fullpath, null, $this->getBasePath());
             if ($archive->isError($rval)) {
                 throw new Engine_Package_Manifest_Exception('Error in archive: ' . $rval->getMessage());
             }
         }
     }
 }
开发者ID:robeendey,项目名称:ce,代码行数:20,代码来源:Directory.php


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