本文整理汇总了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());
}
}
示例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;
}
示例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);
}
}
}
示例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());
}
}
}
}